nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LargeFileJSONParser.ets | arkts | estimateObjectCount | 估算文件中的JSON对象数量(快速扫描) | static async estimateObjectCount(filePath: string): Promise<number> {
try {
const stat = SafeFileUtils.statSync(filePath);
const totalSize = stat.size;
// 采样前1MB来估算
const sampleSize = Math.min(1024 * 1024, totalSize);
const file = SafeFileUtils.openSync(filePath, fs.OpenMode.R... | 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 estimateObjectCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#... | static async estimateObjectCount(filePath: string): Promise<number> {
try {
const stat = SafeFileUtils.statSync(filePath);
const totalSize = stat.size;
// 采样前1MB来估算
const sampleSize = Math.min(1024 * 1024, totalSize);
const file = SafeFileUtils.openSync(filePath, fs.OpenMode.R... | https://github.com/DaLongZhuaZi/manxia | b411ee378d1ac85e458f4aed31357084e1423961 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | deleteProvider | 删除服务商配置 | async deleteProvider(providerId: string): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS)
predicates.equalTo('id', providerId)
try {
await this.rdbStore.delete(predi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteProvider AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async deleteProvider(providerId: string): Promise<void> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return
}
const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS)
predicates.equalTo('id', providerId)
try {
await this.rdbStore.delete(predi... | https://github.com/LongLiveY96/chatcube | 7937994a2fead7d6bb71297dd257372ba55ef4f8 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/unary_plus/unary_plus_float.ets | arkts | main | ---
desc: check unary plus operation for float operand
--- | function main(): void {
const v: float = {{v.value}} as float
const r: float = {{v.result}} as float
if (Float.isNaN(v)) {
assert(Float.isNaN(r))
} else {
assert +(v) == r
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const v: float = {{v.value}} as float
const r: float = {{v.result}} as float
if (Float.isNaN(v)) {
assert(Float.isNaN(r))
} else {
assert +(v) == r
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 08a8fdd11e275bb49bb9dd03d47163074cac7eea | gitee |
seagazer/cclyric | lib/src/main/ets/view/LrcLineView.ets | arkts | stop | Stop the effect animation. | stop() {
this.lyricTextView?.stop()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#ca... | stop() {
this.lyricTextView?.stop()
} | https://github.com/seagazer/cclyric | 9ee7433078717a2637555741edeb811368211b81 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AutomationEngine.ets | arkts | checkScheduleTrigger | 检查定时触发 | private checkScheduleTrigger(trigger: TriggerCondition): boolean {
if (!trigger.time) {
return false;
}
const now = new Date();
const currentTime = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
return currentTime === trigger.time;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkScheduleTrigger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left trigger AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private checkScheduleTrigger(trigger: TriggerCondition): boolean {
if (!trigger.time) {
return false;
}
const now = new Date();
const currentTime = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
return currentTime === trigger.time;
} | https://github.com/LJ666-ui/harmony-health-care | 155b14b83ac221666ea7eb1e27f45c0406abb05b | github |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | setReuseCallback | 设置复用回调
@param reuseCallback | public setReuseCallback(reuseCallback: ReuseCallback) {
this.nodePoolConfig.reuseCallback = reuseCallback;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setReuseCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reuseCallback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public setReuseCallback(reuseCallback: ReuseCallback) {
this.nodePoolConfig.reuseCallback = reuseCallback;
} | https://gitee.com/openharmony-sig/node_pool.git | 1ad7095c9e0bf11e7c8b70272780c8afffc63be4 | gitee |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/FileFolderUtil.ets | arkts | updateFileFolderList | 更新文件夹所有内容 | static async updateFileFolderList(context: Context, file_folder: FileFolder) {
let file_folder_list = Preferences.getFileFolder(context)
file_folder_list = file_folder_list.filter(i => i.date !== file_folder?.date)
file_folder_list.push(file_folder)
Preferences.saveFileFolder(context, file_folder_list... | 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 updateFileFolderList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#... | static async updateFileFolderList(context: Context, file_folder: FileFolder) {
let file_folder_list = Preferences.getFileFolder(context)
file_folder_list = file_folder_list.filter(i => i.date !== file_folder?.date)
file_folder_list.push(file_folder)
Preferences.saveFileFolder(context, file_folder_list... | https://github.com/Yebingiscn/SweetVideo | 86172ba94252da2621d01ab39be7e7fa4088232c | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | getDurationMs | 获取音频流时长
@returns 音频时长(毫秒),未知时返回 0
@remarks
时长来源于解码器的信息,可能为 0(未知) | public getDurationMs(): number {
return this.streamInfo?.durationMs ?? 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDurationMs 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#n... | public getDurationMs(): number {
return this.streamInfo?.durationMs ?? 0;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L258-L260 | 5160ff3a23cab145cad4bae8a93731ac4ca939f1 | github |
Explore-In-HMOS-Wearable/currency-converter | entry/src/main/ets/viewmodel/CurrencyViewModel.ets | arkts | getCurrencyByCode | Get currency by code | getCurrencyByCode(code: string): CurrencyData | undefined {
return this.allCurrencyData.find(c => c.code === code);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrencyByCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | getCurrencyByCode(code: string): CurrencyData | undefined {
return this.allCurrencyData.find(c => c.code === code);
} | https://github.com/Explore-In-HMOS-Wearable/currency-converter | 48ddb52e8440e47f974e0c72a5fe4291ebeb0369 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkStash.ets | arkts | getFolder | Get folder by path.
@param path The path. e.g. '/Bookmarks~Meow/New Folder can now be renamed/Bookmarks~Meow/UpSchool'
@returns The target meowBookmarkItem, or undefined if not found.
@author ChatGLM Web. | getFolder(path: string): meowBookmarkItem | undefined {
if (!path || path.length === 0) return undefined;
let current: meowBookmarkItem = this.root;
let segStart = -1;
let isPathStart = true;
// 遍历路径字符串,手动切割段,避免 split 产生数组分配
for (let i = 0; i <= path.length; i++) {
const c = (i < path.... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFolder 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 stri... | getFolder(path: string): meowBookmarkItem | undefined {
if (!path || path.length === 0) return undefined;
let current: meowBookmarkItem = this.root;
let segStart = -1;
let isPathStart = true;
// 遍历路径字符串,手动切割段,避免 split 产生数组分配
for (let i = 0; i <= path.length; i++) {
const c = (i < path.... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 244ed2b864e41c95ff74f235e44ce01848216d32 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/SFTPHandler.ets | arkts | uploadInChunks | 分块上传大文件 - 使用更保守的64KB块大小
@throws {Error} 如果上传失败 | private async uploadInChunks(localPath: string, remotePath: string, totalSize: number): Promise<void> {
const file = await fs.open(localPath, fs.OpenMode.READ_ONLY);
let offset = 0;
let chunkCount = 0;
const totalChunks = Math.ceil(totalSize / SFTPHandler.UPLOAD_CHUNK_SIZE);
try {
// 使用远程临时... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left uploadInChunks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left localPath AST#identifier#Right AST#ERROR#Left AST#:#L... | private async uploadInChunks(localPath: string, remotePath: string, totalSize: number): Promise<void> {
const file = await fs.open(localPath, fs.OpenMode.READ_ONLY);
let offset = 0;
let chunkCount = 0;
const totalChunks = Math.ceil(totalSize / SFTPHandler.UPLOAD_CHUNK_SIZE);
try {
// 使用远程临时... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/SFTPHandler.ets#L347-L412 | 3a5303092fb55a5dcf9eb32730340f0f5902b51c | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | buildQuery | ---------- query string ---------- | function buildQuery(options: ListOptions | undefined): string {
const parts: string[] = ['format=json'];
parts.push(`limit=${clampLimit(options !== undefined ? options.limit : undefined)}`);
if (options !== undefined && options.start !== undefined) {
parts.push(`start=${options.start}`);
}
if (options !==... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildQuery AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left options AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function buildQuery(options: ListOptions | undefined): string {
const parts: string[] = ['format=json'];
parts.push(`limit=${clampLimit(options !== undefined ? options.limit : undefined)}`);
if (options !== undefined && options.start !== undefined) {
parts.push(`start=${options.start}`);
}
if (options !==... | https://github.com/Vincent-Leon/zotero-harmony | 0f6d705228933e8d1c567d28bc5e6c35165f0d09 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | finishWithResult | @deprecated
@see {ZRouter.getInstance().finishWithResult}
@param result
@param animated | public static finishWithResult<T>(result: T, animated: boolean = true) {
return ZRouter.getRouterMgr().finishWithResult<T>(result, animated)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left finishWithResult AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#... | public static finishWithResult<T>(result: T, animated: boolean = true) {
return ZRouter.getRouterMgr().finishWithResult<T>(result, animated)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L488-L490 | 5963dc213e43044f5f6bbbf7142fd9e106b10c24 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewAuthManager.ets | arkts | serializeCookies | 将 CookieEntry 数组序列化为 JSON(存入数据库) | private serializeCookies(cookies: CookieEntry[]): string {
return JSON.stringify(cookies);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left serializeCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cookies AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | private serializeCookies(cookies: CookieEntry[]): string {
return JSON.stringify(cookies);
} | https://github.com/DaLongZhuaZi/manxia | e07d0bee0ecf3cc857d14ac32d4a7e922640e706 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | writableEnded | Whether Writable.end has been called. | get writableEnded(): boolean {
return this.writableEndedInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left writableEnded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#... | get writableEnded(): boolean {
return this.writableEndedInner;
} | https://gitcode.com/iop123123/arkts-static-skills | d3173074e73bef29b5ea00e78ff69bd0620159cc | gitcode |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets | arkts | setFormLineWidth | sets the line width in dp for forms that consist of lines, default 3f
@param size | public setFormLineWidth(size : number) : void {
this.mFormLineWidth = size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFormLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setFormLineWidth(size : number) : void {
this.mFormLineWidth = size;
} | https://gitee.com/openharmony-sig/smartperf.git | 38a5a83dfda5860da924b7a9f826473b18118e6d | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets | arkts | isLessThan | Checks if this instance value is less than value of provided instance
@param { Short } other Right hand side of the comparison
@returns { boolean } true if this value is less than provided, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isLessThan(other: Short): boolean {
return this.value < other.toShort();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLessThan 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 Shor... | public isLessThan(other: Short): boolean {
return this.value < other.toShort();
} | https://gitcode.com/iop123123/arkts-static-skills | 2b0e50d777b9c96982acd6159362313256f7ef21 | gitcode |
IoTAccessControl/ArkTSAnalysis | TestApps/AccountKit-QuickLogin/entry/src/main/ets/common/ShowToast.ets | arkts | getErrorHint | Obtain the error message.
@param error BusinessError. | function getErrorHint(error: BusinessError): string {
const mainErrorMessage: string = error.message.split('.').shift() as string;
return `${error.code}: ${mainErrorMessage}.`;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getErrorHint AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left error AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function getErrorHint(error: BusinessError): string {
const mainErrorMessage: string = error.message.split('.').shift() as string;
return `${error.code}: ${mainErrorMessage}.`;
} | https://github.com/IoTAccessControl/ArkTSAnalysis | 62a43243bb704a7bbc63365ef2c7dd64ed2e6d86 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | setNotifyOnFailed | 设置”失败时通知”开关 | async setNotifyOnFailed(enabled: boolean): Promise<void> {
await this.setBoolean(PreferenceKeys.NOTIFY_ON_FAILED, enabled)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setNotifyOnFailed AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left enabled AST#identifier#Right AST#type_annotation#Left AST#:#L... | async setNotifyOnFailed(enabled: boolean): Promise<void> {
await this.setBoolean(PreferenceKeys.NOTIFY_ON_FAILED, enabled)
} | https://github.com/LongLiveY96/chatcube | 64bfe40cf66f4ca69d4e5a2dd9364b7afd1abd3d | github |
Bistu-OSSDT-2024/16-ArkNotes | Index.ets | arkts | onKeywordsChange | 监听搜索关键词的过滤方法 | onKeywordsChange() {
if (this.keywords.length === 0) {
this.memoList = this.originMemoList
this.refreshByOrder()
} else {
let resultList: MemoModel[] = []
for (const memoItem of this.originMemoList) {
if (memoItem.content.includes(this.keywords)) {
resultList.push(me... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onKeywordsChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | onKeywordsChange() {
if (this.keywords.length === 0) {
this.memoList = this.originMemoList
this.refreshByOrder()
} else {
let resultList: MemoModel[] = []
for (const memoItem of this.originMemoList) {
if (memoItem.content.includes(this.keywords)) {
resultList.push(me... | https://github.com/Bistu-OSSDT-2024/16-ArkNotes | 98032c49b66f763f03323bbec77a5fe65c774644 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateFactory.ets | arkts | getUserStrategy | 获取用户模板策略 | getUserStrategy(): UserTemplateStrategy {
return this.userStrategy;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserStrategy 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 UserTemplateStrategy AST#identifier#Right AST#... | getUserStrategy(): UserTemplateStrategy {
return this.userStrategy;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateFactory.ets#L243-L245 | 8e01d0bac92cea6d041067d4c58e10aace4fe6f7 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | write | Writes a chunk to Writable and invokes callback when the chunk is flushed. The return value indicates
whether the internal buffer of the Writable reaches the hightWaterMark. If true is returned, the buffer
does not reach the hightWaterMark. If false is returned, the buffer has been reached. The write function
should be... | write(chunk?: string | Uint8Array, encoding?: string, callback?: Function): boolean {
if (encoding) {
this.setEncoding(encoding!);
}
if (chunk === null || chunk === undefined) {
throw createBusinessError(401, `Parameter error. The type of ${chu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Le... | write(chunk?: string | Uint8Array, encoding?: string, callback?: Function): boolean {
if (encoding) {
this.setEncoding(encoding!);
}
if (chunk === null || chunk === undefined) {
throw createBusinessError(401, `Parameter error. The type of ${chu... | https://gitcode.com/iop123123/arkts-static-skills | 5a12ebc5a78ef37fee7f85ddb8983e16641370b5 | gitcode |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/components/ImageCropper.ets | arkts | _doAspectRatioH | /horizontal | _doAspectRatioH(minD: number, result: geometry.Rect, aspectRatio: number, layerDestinationRect: geometry.Rect,
isLeft: boolean): geometry.Rect {
let height =
Math.max(minD, Math.min(result.width / aspectRatio, layerDestinationRect.height));
let width = height * aspectRatio;
let left = isLeft ? r... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left _doAspectRatioH AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left minD AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | _doAspectRatioH(minD: number, result: geometry.Rect, aspectRatio: number, layerDestinationRect: geometry.Rect,
isLeft: boolean): geometry.Rect {
let height =
Math.max(minD, Math.min(result.width / aspectRatio, layerDestinationRect.height));
let width = height * aspectRatio;
let left = isLeft ? r... | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/components/ImageCropper.ets#L983-L992 | 0338cbf231dcfd4e617398604b2bb0e8ffaea0a7 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/utils/CommonUtils.ets | arkts | showToast | Show a simple toast message with debounce (anti-spam) logic.
@param curMsg ResourceStr message to display. | public static showToast(curMsg: ResourceStr) {
const currentTime = Date.now();
// Debounce determination: If the elapsed time since the last operation is less than the default interval,
// intercept immediately and skip subsequent logic.
if (currentTime - CommonUtils.lastClickTime < CommonConstants.D... | 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 showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left curMsg AST#identifier#Right AST#:#Left : AST#... | public static showToast(curMsg: ResourceStr) {
const currentTime = Date.now();
// Debounce determination: If the elapsed time since the last operation is less than the default interval,
// intercept immediately and skip subsequent logic.
if (currentTime - CommonUtils.lastClickTime < CommonConstants.D... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 549c2c601820accc144b6b81d619a60e0cc470d5 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | switchUser | 切换用户(用于测试或管理员功能)
@param userId 用户ID | static async switchUser(userId: number): Promise<boolean> {
try {
const user: User | null = await UserDAO.getById(userId);
if (!user) {
console.error(`[UserSessionService] 用户不存在: ${userId}`);
return false;
}
const now: string = new Date().toISOString();
const newSess... | 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 switchUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#... | static async switchUser(userId: number): Promise<boolean> {
try {
const user: User | null = await UserDAO.getById(userId);
if (!user) {
console.error(`[UserSessionService] 用户不存在: ${userId}`);
return false;
}
const now: string = new Date().toISOString();
const newSess... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 514c4cec4a43d1898e3387dcd6b70eb05bff899b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | isFailed | 检查页面是否加载失败 | isFailed(pageIndex: number): boolean {
return this.failed.has(pageIndex);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isFailed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig... | isFailed(pageIndex: number): boolean {
return this.failed.has(pageIndex);
} | https://github.com/DaLongZhuaZi/manxia | c1b88c69270c38ff94b959726da8c260134eb93b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | toBoolean | Returns value of this instance
@returns { boolean } The instance value converted to boolean.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toBoolean(): boolean {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toBoolean 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#boo... | public toBoolean(): boolean {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | 757fed8a0c9833337d313462768822e01cb1457f | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistoryEntry.ets | arkts | tokenizeSelf | Ensures that this meowHistory entry is tokenized. Process entry to tokens if it doesn't have tokens built yet. | tokenizeSelf() {
if (this.tokens) {
return; // Do nothing
}
// Decode Url
let decodedUrl: string;
try {
decodedUrl = decodeURI(this.url);
} catch (e) {
try {
decodedUrl = decodeURI(this.url.replaceAll('%S', ''));
meow(`Troubles in decoding URL: ${this.url}, e... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tokenizeSelf 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 ... | tokenizeSelf() {
if (this.tokens) {
return; // Do nothing
}
// Decode Url
let decodedUrl: string;
try {
decodedUrl = decodeURI(this.url);
} catch (e) {
try {
decodedUrl = decodeURI(this.url.replaceAll('%S', ''));
meow(`Troubles in decoding URL: ${this.url}, e... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 147d0b6af57183f81a20acbb4c06a1206d0abc77 | github |
Vsolon0401/MallShopping | common/src/main/ets/utils/Preferences.ets | arkts | get | 获取数据
@param key: 读取key值
@param def: 默认返回值
@returns | async get(key: string, def?: ValueType): Promise<ValueType> {
return (await this.getPreferences()).get(key, def)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key... | async get(key: string, def?: ValueType): Promise<ValueType> {
return (await this.getPreferences()).get(key, def)
} | https://github.com/Vsolon0401/MallShopping | 18422f20b371d559dfad2fb9902636e1a375bd80 | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/PipManager.ets | arkts | enter | Returns true when the system has accepted the request (not necessarily already in `started`). | async enter(): Promise<boolean> {
if (PIP_DISABLED) {
return false;
}
if (!this.isSupported()) {
Logger.warn('PipManager.enter: PiP not supported on this device');
return false;
}
if (!this.context) {
Logger.error('PipManager.enter: context not initialized; call init() firs... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left enter AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async enter(): Promise<boolean> {
if (PIP_DISABLED) {
return false;
}
if (!this.isSupported()) {
Logger.warn('PipManager.enter: PiP not supported on this device');
return false;
}
if (!this.context) {
Logger.error('PipManager.enter: context not initialized; call init() firs... | https://github.com/Tencent-RTC/TUIKit_Harmony | 493ceb7262b6df9439e3ee867773713f81352af3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | getPrefetchedPages | [优化] 获取预取的页面列表(供 MangaReaderPage 调用) | static getPrefetchedPages(sourceId: number, chapterId: string): PageInfo[] | null {
const key = `${sourceId}_${chapterId}`;
const cached = MangaSourceEngine.prefetchedPageLists.get(key);
if (cached && (Date.now() - cached.timestamp) < MangaSourceEngine.PREFETCH_CACHE_TTL_MS) {
MangaSourceEngine.pref... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPrefetchedPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | static getPrefetchedPages(sourceId: number, chapterId: string): PageInfo[] | null {
const key = `${sourceId}_${chapterId}`;
const cached = MangaSourceEngine.prefetchedPageLists.get(key);
if (cached && (Date.now() - cached.timestamp) < MangaSourceEngine.PREFETCH_CACHE_TTL_MS) {
MangaSourceEngine.pref... | https://github.com/DaLongZhuaZi/manxia | 8f5006d5f3a638df5b1b716bc9786369aa75df7d | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getViewPortHandler | Returns the ViewPortHandler of the chart that is responsible for the
content area of the chart and its offsets and dimensions.
@return | public getViewPortHandler(): ViewPortHandler {
return this.mViewPortHandler;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getViewPortHandler 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 Vie... | public getViewPortHandler(): ViewPortHandler {
return this.mViewPortHandler;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 4c2e5635e3b839cf168d42bab488c3807aa9599d | gitee |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/entity/CategoryTree.ets | arkts | tryBuildTreeFromNested | 尝试从已包含 children 的数据中构建树
@param {Category[]} categories - 原始分类列表
@returns {CategoryTree[]} 构建后的树结构 | private static tryBuildTreeFromNested(categories: Category[]): CategoryTree[] {
const hasChildren: boolean = categories.some((item: Category): boolean => {
return (item.children ?? []).length > 0;
});
if (!hasChildren) {
return [];
}
return categories.map((item: Category): CategoryTree... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left tryBuildTreeFromNested AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Le... | private static tryBuildTreeFromNested(categories: Category[]): CategoryTree[] {
const hasChildren: boolean = categories.some((item: Category): boolean => {
return (item.children ?? []).length > 0;
});
if (!hasChildren) {
return [];
}
return categories.map((item: Category): CategoryTree... | https://github.com/Joker-x-dev/CoolMallArkTS | ff9f5b03a3b247033b51ad2802d7f6e7d93896cb | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/CommentViewModel.ets | arkts | sendComment | 发送评论/回复 | async sendComment() {
if (this.inputText.trim().length === 0) return;
try {
const parentId = this.replyTarget?.id;
// ✅ 调用合并后的接口
await pixiv.addComment(this.type, this.targetId, this.inputText, parentId);
this.inputText = '';
this.replyTarget = null;
// 发送成功后刷新列表
th... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendComment AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Ri... | async sendComment() {
if (this.inputText.trim().length === 0) return;
try {
const parentId = this.replyTarget?.id;
// ✅ 调用合并后的接口
await pixiv.addComment(this.type, this.targetId, this.inputText, parentId);
this.inputText = '';
this.replyTarget = null;
// 发送成功后刷新列表
th... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/CommentViewModel.ets#L104-L119 | 9cad352b92ddf368ab7a0fb70b378028cfaacc56 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/AppViewModel.ets | arkts | hasRunningApp | 是否有正在运行的应用 | get hasRunningApp(): boolean {
return this.runningApp !== null;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left hasRunningApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#... | get hasRunningApp(): boolean {
return this.runningApp !== null;
} | https://github.com/AlkaidLab/moonlight-harmony | 672cb5fe6ea7bb25f2bf685f9fa673db5ae7663b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | of | Creates a new Int8Array using initializer
@param data initializer
@returns a new Int8Array from data | public of(data: Object[]): Int8Array {
throw new Error("Int8Array.of: 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 of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public of(data: Object[]): Int8Array {
throw new Error("Int8Array.of: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 366538dff187a9e3fffbf7d0cbabf5dd470673dc | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/ParentalControlService.ets | arkts | generateDailyReport | 生成每日报告 | public async generateDailyReport(date?: string): Promise<DailyReport> {
const targetDate = date || this.getTodayString();
const stats = await this.getLearningStats();
const usageRecords = await this.getUsageRecords();
const dayStats = stats.filter(s => s.date === targetDate);
const dayUsage = usa... | 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 generateDailyReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#?#Left... | public async generateDailyReport(date?: string): Promise<DailyReport> {
const targetDate = date || this.getTodayString();
const stats = await this.getLearningStats();
const usageRecords = await this.getUsageRecords();
const dayStats = stats.filter(s => s.date === targetDate);
const dayUsage = usa... | https://github.com/the-wwyang/kids-learning-app | 48289ab147c684bf15aaf6e945fdeed5b94930b2 | github |
openharmony/applications_app_samples | code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets | arkts | push | 通过获取页面栈跳转到指定页面 | public static async push(url: string): Promise<void>{
// 分解url
// 获取包名、路由名、页面名
let params = url.split("/");
const harName = params[0];
let context = params[params.length - 1].split("-");
const routerName = context[0];
const builderName = context[1];
// 获取路径
let path = ".";
for ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left push AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#ident... | public static async push(url: string): Promise<void>{
// 分解url
// 获取包名、路由名、页面名
let params = url.split("/");
const harName = params[0];
let context = params[params.length - 1].split("-");
const routerName = context[0];
const builderName = context[1];
// 获取路径
let path = ".";
for ... | https://github.com/openharmony/applications_app_samples | ac63284d8354416cc82491c37b044ea1576afe30 | github |
openharmony-tpc/ohos_coap | libcoap/src/main/ets/components/mainpage/CoapClient.ets | arkts | setBlockMode | 设置block_mode
@param mode CoapBlockMode, The default value is COAP_BLOCK_USE_LIBCOAP | setBlockMode(mode: CoapBlockMode): void {
this.coapClient.setBlockMode(mode, this.classId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBlockMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CoapBlockMode AST#identifier#Right AST#)#Le... | setBlockMode(mode: CoapBlockMode): void {
this.coapClient.setBlockMode(mode, this.classId);
} | https://gitee.com/openharmony-tpc/ohos_coap.git | e61df66767bb156788737cd0c7d4ef613ff0c99c | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | end | Write the last chunk to Writable.
@param { string | Uint8Array } [chunk] - Data to be written.
@param { string } [encoding] - Encoding type.
@param { Function } [callback] - Callback after writing.
@returns { Writable } Returns the Writable object.
@throws { BusinessError } 401 - Parameter error.
@throws { BusinessErro... | end(chunk?: string | Uint8Array, encoding?: string, callback?: Function): Writable {
if (this.erroredInner) {
Promise.resolve().then((): void => {callback?.unsafeCall(this.erroredInner!)});
return this;
}
if (this.writableFinishedInner) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left end AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left... | end(chunk?: string | Uint8Array, encoding?: string, callback?: Function): Writable {
if (this.erroredInner) {
Promise.resolve().then((): void => {callback?.unsafeCall(this.erroredInner!)});
return this;
}
if (this.writableFinishedInner) {
... | https://gitcode.com/iop123123/arkts-static-skills | b39148a0a0dce2eb55d5c381bb5fbc35efb51641 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | createProgressSnapshot | 生成进度快照:返回新数组和新分组对象,保证 UI 能感知到状态更新 | private createProgressSnapshot(groups: SearchSourceGroup[]): SearchSourceGroup[] {
const snapshot: SearchSourceGroup[] = [];
for (const group of groups) {
snapshot.push({
groupId: group.groupId,
groupName: group.groupName,
contentType: group.contentType,
sourceType: group... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createProgressSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left groups AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | private createProgressSnapshot(groups: SearchSourceGroup[]): SearchSourceGroup[] {
const snapshot: SearchSourceGroup[] = [];
for (const group of groups) {
snapshot.push({
groupId: group.groupId,
groupName: group.groupName,
contentType: group.contentType,
sourceType: group... | https://github.com/DaLongZhuaZi/manxia | 77cc6d5523baa8ae84a874a501a4dd31915d2121 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | OhosVideoCache/library/src/main/ets/ProxyCacheUtils.ets | arkts | uint8ArrayToHexStr | 将 Uint8Array 转换为十六进制字符串 | private static uint8ArrayToHexStr(data: Uint8Array): string {
let hexString = '';
for (let i = 0; i < data.length; i++) {
let char = ('00' + data[i].toString(16)).slice(-2);
hexString += char;
}
return hexString;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left uint8ArrayToHexStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#L... | private static uint8ArrayToHexStr(data: Uint8Array): string {
let hexString = '';
for (let i = 0; i < data.length; i++) {
let char = ('00' + data[i].toString(16)).slice(-2);
hexString += char;
}
return hexString;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | fb4cfca06ee88caa4ad71adb094c09b4410dddcf | gitcode |
offlinecat-dev/OCNetORM | example/repository/UserRepository.ets | arkts | createUser | 创建用户
@param username 用户名
@param email 邮箱
@param age 年龄
@returns 保存结果 | async createUser(username: string, email: string, age?: number): Promise<SaveResult> {
const userData = new EntityData('UserEntity')
userData.addProperty('username', username, 'string')
userData.addProperty('email', email, 'string')
userData.addProperty('age', age ?? 0, 'number')
userData.addPrope... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async createUser(username: string, email: string, age?: number): Promise<SaveResult> {
const userData = new EntityData('UserEntity')
userData.addProperty('username', username, 'string')
userData.addProperty('email', email, 'string')
userData.addProperty('age', age ?? 0, 'number')
userData.addPrope... | https://github.com/offlinecat-dev/OCNetORM | 6349c0d146c04fbeec1401a523d58bbf42d9b8bb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | supportsCapability | 检查图源是否支持指定能力
@param capability 能力名称(工作流名称)
@returns 是否支持 | supportsCapability(capability: string): boolean {
if (!this.config) return false;
return this.configParser.hasWorkflow(this.config, capability);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left supportsCapability AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capability AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ... | supportsCapability(capability: string): boolean {
if (!this.config) return false;
return this.configParser.hasWorkflow(this.config, capability);
} | https://github.com/DaLongZhuaZi/manxia | 3436da523bbb28904fffe16c2d9785c52d8952ae | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/FileContentService.ets | arkts | getFileMetadata | ===================== 元数据与工具方法 =====================
获取文件元数据(不读取内容) | static getFileMetadata(uri: string): FileMetadata | null {
try {
const stat = fs.statSync(uri);
const fileName = FileContentService.extractFileName(uri);
return {
fileName: fileName,
sizeBytes: stat.size,
isDirectory: stat.isDirectory(),
modifiedTime: stat.mtimeNs... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | static getFileMetadata(uri: string): FileMetadata | null {
try {
const stat = fs.statSync(uri);
const fileName = FileContentService.extractFileName(uri);
return {
fileName: fileName,
sizeBytes: stat.size,
isDirectory: stat.isDirectory(),
modifiedTime: stat.mtimeNs... | https://github.com/XJTUWYD/ArkDiff | 9c42f0a3223e56058e670ac244ad6715b8166d5f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets | arkts | asin | Arcsine of angle `v`
@param v angle in radians
@returns Arcsine of angle `v` | public static asin(x: float): float {
return asin(x);
} | 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 asin AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#ident... | public static asin(x: float): float {
return asin(x);
} | https://gitcode.com/iop123123/arkts-static-skills | 5307f11d575930ecbc2a1802fbcb3f2bf1590a44 | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/storage/PreferencesUtil.ets | arkts | getNumber | 获取数字值 | static async getNumber(key: string, defaultValue: number = 0): Promise<number> {
if (PreferencesUtil.preferencesInstance === null) {
return defaultValue;
}
try {
const value = await PreferencesUtil.preferencesInstance.get(key, defaultValue);
return value as number;
} catch (err) {
... | 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 getNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri... | static async getNumber(key: string, defaultValue: number = 0): Promise<number> {
if (PreferencesUtil.preferencesInstance === null) {
return defaultValue;
}
try {
const value = await PreferencesUtil.preferencesInstance.get(key, defaultValue);
return value as number;
} catch (err) {
... | https://github.com/Amaz1ny/HarmonyDO-public | f7f0f5d09798c793d7cbe327a7c5e74dddacd12a | github |
openharmony/codelabs | ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets | arkts | addSkill | ==================== 学习模块方法 ==================== | async addSkill(skill: Skill): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
name: skill.name,
category: skill.category,
level: skill.level || 1,
targetLevel: sk... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addSkill AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left skill AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async addSkill(skill: Skill): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
name: skill.name,
category: skill.category,
level: skill.level || 1,
targetLevel: sk... | https://gitcode.com/openharmony/codelabs | e6563391ee29ec361601f9ac45845e84bb5245aa | gitcode |
arkui-x/samples | CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets | arkts | isNotNullEmpty | 判断数组不为空和未定义
param 数组对象Array<Object>
@returns boolean | static isNotNullEmpty(list: Array<Object> | undefined): boolean {
return null !== list && undefined !== list && list.length >= 1;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNotNullEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression... | static isNotNullEmpty(list: Array<Object> | undefined): boolean {
return null !== list && undefined !== list && list.length >= 1;
} | https://gitcode.com/arkui-x/samples | 132eba0c8a72913117a2b6e7e4e59b33ad74cb17 | gitcode |
honjow/Next2V | shared/src/main/ets/parser/V2exCollectionActionParser.ets | arkts | extractNodeIgnoreToggle | Node ignore/un-ignore toggle, same two-URL shape as favorite (verified against live V2EX 2026-06):
not-ignored renders `/settings/ignore/node/{id}?once=` ("忽略这个节点"); ignored renders
`/settings/unignore/node/{id}?once=` ("取消忽略节点"). Check the unignore href FIRST. | static extractNodeIgnoreToggle(html: string): V2exToggleAction | null {
if (!html) {
return null
}
const unignoreRe = /href=['"]([^'"]*\/settings\/unignore\/node\/\d+[^'"]*)['"]/i
const unignore = html.match(unignoreRe)
if (unignore && unignore[1]) {
return { currentlyOn: true, actionP... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractNodeIgnoreToggle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static extractNodeIgnoreToggle(html: string): V2exToggleAction | null {
if (!html) {
return null
}
const unignoreRe = /href=['"]([^'"]*\/settings\/unignore\/node\/\d+[^'"]*)['"]/i
const unignore = html.match(unignoreRe)
if (unignore && unignore[1]) {
return { currentlyOn: true, actionP... | https://github.com/honjow/Next2V | 1db7cd155ff33d7d82c28c429e889532ecc82c71 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/ChatService.ets | arkts | getChatHistory | 获取聊天历史 | async getChatHistory(sessionId: string, before?: number, limit: number = 50): Promise<ChatMessage[]> {
try {
const params: Map<string, Object> = new Map();
params.set('limit', limit);
if (before) {
params.set('before', before);
}
const response = await HttpUtil.get<Cha... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getChatHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async getChatHistory(sessionId: string, before?: number, limit: number = 50): Promise<ChatMessage[]> {
try {
const params: Map<string, Object> = new Map();
params.set('limit', limit);
if (before) {
params.set('before', before);
}
const response = await HttpUtil.get<Cha... | https://github.com/LJ666-ui/harmony-health-care | 26eb38877507e78a3237b8c685582baed37fbbc7 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/QuestionGenerator.ets | arkts | collectServerDistractors | V0.5 schema_v2 path: turn each server-supplied distractor string
into a synthetic WordEntry so the rest of pickDistractors can
treat it uniformly. Filters duplicates and answer collisions;
capped at `needed` entries. | private collectServerDistractors(answer: WordEntry, needed: number): WordEntry[] {
const raw: string[] | undefined = answer.distractors;
if (raw === undefined || raw.length === 0) {
return [];
}
const seen: Set<string> = new Set<string>();
seen.add(answer.word);
const out: WordEntry[] = ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left collectServerDistractors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left answer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | private collectServerDistractors(answer: WordEntry, needed: number): WordEntry[] {
const raw: string[] | undefined = answer.distractors;
if (raw === undefined || raw.length === 0) {
return [];
}
const seen: Set<string> = new Set<string>();
seen.add(answer.word);
const out: WordEntry[] = ... | https://github.com/terryma2024/happyword | 783e3cbc1b37ff0dbb84a563c245f117800b0422 | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/StringUtil.ets | arkts | truncate | 截断字符串
@param str 原始字符串
@param maxLength 最大长度
@returns 截断后的字符串 | static truncate(str: string, maxLength: number): string {
if (str.length <= maxLength) {
return str;
}
return str.substring(0, maxLength) + '...';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left truncate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | static truncate(str: string, maxLength: number): string {
if (str.length <= maxLength) {
return str;
}
return str.substring(0, maxLength) + '...';
} | https://github.com/mqxu/HarmonyOS_In_Action | 38a865ab25fa9a7aef53a8c4576b0d59df68a3b7 | github |
admundhou/mshijie | product/default/src/main/ets/controller/VideoController.ets | arkts | initPlayerThis | Pass this on the playback page.
@param playerThis PlayPlayer this object. | initPlayerThis(playerThis) {
this.playerThis = playerThis;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initPlayerThis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left playerThis AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AS... | initPlayerThis(playerThis) {
this.playerThis = playerThis;
} | https://github.com/admundhou/mshijie | 32f1480f78ac05959d3b3a0f1f9fb4d05038f1f2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | saveSourceUserSetting | 保存图源用户设置(通用键值)
[重构] 使用 pkg 作为键的一部分,确保图源删除/重装后设置不丢失 | async saveSourceUserSetting(sourceId: number, keyName: string, value: string, type: string): Promise<void> {
// 优先使用 pkg,如果获取不到则回退到 sourceId
const pkg = await this.getSourcePkgById(sourceId);
const keyIdentifier = pkg || `id_${String(sourceId)}`;
const key: string = `source:${keyIdentifier}:${keyName}... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveSourceUserSetting AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS... | async saveSourceUserSetting(sourceId: number, keyName: string, value: string, type: string): Promise<void> {
// 优先使用 pkg,如果获取不到则回退到 sourceId
const pkg = await this.getSourcePkgById(sourceId);
const keyIdentifier = pkg || `id_${String(sourceId)}`;
const key: string = `source:${keyIdentifier}:${keyName}... | https://github.com/DaLongZhuaZi/manxia | 71737b769888583cc52fbf85c280be2c446e4f40 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | getElementById | ==================== 便捷查询方法 ====================
通过 ID 获取元素 | getElementById(id: string): HTMLElement | null {
return this.querySelector(`#${id}`);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getElementById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | getElementById(id: string): HTMLElement | null {
return this.querySelector(`#${id}`);
} | https://github.com/DaLongZhuaZi/manxia | 0f81af964e690a0455bf4923b54fe363493632cb | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | exportAssociations | 导出关联数据 | exportAssociations(): string {
const allAssociations: WordAssociation[] = [];
this.associations.forEach((assocList: WordAssociation[]) => {
allAssociations.push(...assocList);
});
const data: ExportedAssociation[] = allAssociations.map((assoc: WordAssociation): ExportedAssociation => {
r... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exportAssociations 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#sta... | exportAssociations(): string {
const allAssociations: WordAssociation[] = [];
this.associations.forEach((assocList: WordAssociation[]) => {
allAssociations.push(...assocList);
});
const data: ExportedAssociation[] = allAssociations.map((assoc: WordAssociation): ExportedAssociation => {
r... | https://github.com/CLMC2025/Vignette | 31bcac4fdbf03dcbbc3be4d8ae9bb97fed726f8a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SessionManager.ets | arkts | startSessionRefresh | 启动会话自动刷新 | async startSessionRefresh(
sourceId: number,
config: SessionRefreshConfig,
refreshCallback: () => Promise<void>
): Promise<void> {
if (!config.enabled) {
logger.info(TAG, `会话自动刷新未启用: sourceId=${sourceId}`);
return;
}
// 停止已存在的刷新任务
this.stopSessionRefresh(sourceId);
// 保... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startSessionRefresh AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#R... | async startSessionRefresh(
sourceId: number,
config: SessionRefreshConfig,
refreshCallback: () => Promise<void>
): Promise<void> {
if (!config.enabled) {
logger.info(TAG, `会话自动刷新未启用: sourceId=${sourceId}`);
return;
}
// 停止已存在的刷新任务
this.stopSessionRefresh(sourceId);
// 保... | https://github.com/DaLongZhuaZi/manxia | 11e8e2343902b0d43fa8a4bb7fb8e5aed6e332fe | github |
wuba/omni-ui | omni_component/src/main/ets/components/tabs/OmniTabs.ets | arkts | build | 指示器的位置x | build() {
RelativeContainer(){
if (this.tabConfig.mode === OmniTabMode.Scrollable) {
Row() {
if (this.tabItem.leftIcon) {
Image(this.tabItem.leftIcon)
.width(20)
.aspectRatio(1)
.objectFit(ImageFit.Auto)
}
Text(`${th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#ERROR#Left AST#method_definitio... | build() {
RelativeContainer(){
if (this.tabConfig.mode === OmniTabMode.Scrollable) {
Row() {
if (this.tabItem.leftIcon) {
Image(this.tabItem.leftIcon)
.width(20)
.aspectRatio(1)
.objectFit(ImageFit.Auto)
}
Text(`${th... | https://github.com/wuba/omni-ui | 957817a9832cfa5d501a11daeeaeaf08739443d3 | github |
arkui-x/samples | CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets | arkts | constructor | 存放区信息 | constructor(code: string = '', name: string = '', children: Region[]) {
this.code = code;
this.name = name;
this.children = children;
} | 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 code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Lef... | constructor(code: string = '', name: string = '', children: Region[]) {
this.code = code;
this.name = name;
this.children = children;
} | https://gitcode.com/arkui-x/samples | 32c34f26ae9d871e579cd4a3d4283aeb797d5888 | gitcode |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertVolume | VOLUME | static convertVolume(value: number, from: VolumeUnit, to: VolumeUnit): number {
const toLiters: Record<VolumeUnit, number> = {
[VolumeUnit.MILLILITER]: 0.001,
[VolumeUnit.LITER]: 1,
[VolumeUnit.CUBIC_CENTIMETER]: 0.001,
[VolumeUnit.CUBIC_METER]: 1000,
[VolumeUnit.TEASPOON]: 0.0049289... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | static convertVolume(value: number, from: VolumeUnit, to: VolumeUnit): number {
const toLiters: Record<VolumeUnit, number> = {
[VolumeUnit.MILLILITER]: 0.001,
[VolumeUnit.LITER]: 1,
[VolumeUnit.CUBIC_CENTIMETER]: 0.001,
[VolumeUnit.CUBIC_METER]: 1000,
[VolumeUnit.TEASPOON]: 0.0049289... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | dbbd0f9f90f3dfe44ffed491992380365e91e200 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/UnifiedContentAdapter.ets | arkts | toUnifiedChapter | 将电子书章节转换为统一章节模型 | static toUnifiedChapter(
chapter: EBookChapter,
index: number,
currentChapterIndex: number
): UnifiedChapter {
// 判断章节是否已读(基于当前阅读位置)
const isRead = index < currentChapterIndex;
return {
id: chapter.id,
title: chapter.title,
index: index,
isRead: isRead,
isD... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toUnifiedChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static toUnifiedChapter(
chapter: EBookChapter,
index: number,
currentChapterIndex: number
): UnifiedChapter {
// 判断章节是否已读(基于当前阅读位置)
const isRead = index < currentChapterIndex;
return {
id: chapter.id,
title: chapter.title,
index: index,
isRead: isRead,
isD... | https://github.com/DaLongZhuaZi/manxia | 1d6fa1296278ac7595d18151f0dd8b6d1f4693a7 | github |
Countly/countly-sdk-hos | library/src/ohosTest/ets/test/Configuration.test.ets | arkts | buildSbsBody | Helpers to build well-formed and malformed SBS payloads. Centralised so
each test reads as a behavioural assertion rather than a JSON literal. | function buildSbsBody(inner: Record<string, Object>): string {
const env: Record<string, Object> = {};
env['v'] = 1;
env['t'] = Date.now();
env['c'] = inner;
return JSON.stringify(env);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildSbsBody AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left inner AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function buildSbsBody(inner: Record<string, Object>): string {
const env: Record<string, Object> = {};
env['v'] = 1;
env['t'] = Date.now();
env['c'] = inner;
return JSON.stringify(env);
} | https://github.com/Countly/countly-sdk-hos | d2fd67164fd8a72b9406d8c261c39ff144dc0772 | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/services/PreferencesStore.ets | arkts | saveVoluntaryOTActive | ---- Voluntary Overtime Session State ---- | public async saveVoluntaryOTActive(active: boolean): Promise<void> {
if (this.store === null) { return }
try {
await this.store.put('voluntaryOTActive', active ? 1 : 0)
await this.store.flush()
} catch (err) {
Log.error(`saveVoluntaryOTActive 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 saveVoluntaryOTActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left active AST#identifier#Right AST#:#... | public async saveVoluntaryOTActive(active: boolean): Promise<void> {
if (this.store === null) { return }
try {
await this.store.put('voluntaryOTActive', active ? 1 : 0)
await this.store.flush()
} catch (err) {
Log.error(`saveVoluntaryOTActive failed: ${err}`)
}
} | https://github.com/OMGCA/sakipay | dedad2da124feb3d89e1171ade738d6f2e72ee48 | github |
silence17/harmonydemo | entry/src/main/ets/pages/PromisePage.ets | arkts | imageProcessing | /校验并发函数, 将@Concurrent修饰的函数放在组件外部
@ts-ignore | @Concurrent
async function imageProcessing(dataSlice: ArrayBuffer) {
Log.error("task....0 " + dataSlice.toString())
// 步骤1: 具体的图像处理操作及其他耗时操作
return dataSlice;
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left imageProcessing AST#identifier#Right AST#formal_parame... | @Concurrent
async function imageProcessing(dataSlice: ArrayBuffer) {
Log.error("task....0 " + dataSlice.toString())
// 步骤1: 具体的图像处理操作及其他耗时操作
return dataSlice;
} | https://github.com/silence17/harmonydemo | f05b50b0069e78ca6918ff70ce347a9f8fe79830 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/TouchEventProcessor.ets | arkts | constureCustomTouchEvent | Construct the CustomTouchEvent and return. | public constureCustomTouchEvent(strings: Array<string>, top: number, left: number) : CustomTouchEvent {
let densityPixels:number = display.getDefaultDisplaySync().densityPixels;
let touchPacket: TouchPacket = this.decodeTouchPacket(strings, densityPixels, top, left);
let customTouchEvent: CustomTouchEven... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constureCustomTouchEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left strings AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public constureCustomTouchEvent(strings: Array<string>, top: number, left: number) : CustomTouchEvent {
let densityPixels:number = display.getDefaultDisplaySync().densityPixels;
let touchPacket: TouchPacket = this.decodeTouchPacket(strings, densityPixels, top, left);
let customTouchEvent: CustomTouchEven... | https://gitee.com/openharmony-sig/flutter_engine.git | 570ae161ca6267e3f13f54e1c119dbbfb9e9419c | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | calculateStatistics | ==================== 私有方法:统计计算 ====================
计算基础统计指标 | private static calculateStatistics(data: number[]): StatisticalMetrics {
const n = data.length;
if (n === 0) {
return {
mean: 0,
median: 0,
stdDev: 0,
variance: 0,
cv: 0,
min: 0,
max: 0,
range: 0
};
}
// 均值
const sum = da... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#... | private static calculateStatistics(data: number[]): StatisticalMetrics {
const n = data.length;
if (n === 0) {
return {
mean: 0,
median: 0,
stdDev: 0,
variance: 0,
cv: 0,
min: 0,
max: 0,
range: 0
};
}
// 均值
const sum = da... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8eee41687dfdf3887b568a9ce13c5810c2df8f3f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | sort | TODO(kprokopenko): this may be not skipped
Sorts in-place
@param fn comparator
@returns sorted Int16Array | public sort(fn: (a: short, b: short) => int): Int16Array {
let arr: short[] = new short[this.length]
for (let i = 0; i < this.length; ++i) {
arr[i] = this.at(i)
}
// TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961
/*
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public sort(fn: (a: short, b: short) => int): Int16Array {
let arr: short[] = new short[this.length]
for (let i = 0; i < this.length; ++i) {
arr[i] = this.at(i)
}
// TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961
/*
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d6606569c086a486d5041126c4ffef28548411a3 | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets | arkts | custom | 自定义缓动函数插值器 | static custom(easingFunction: (t: number) => number): curves.ICurve {
const midPoint = easingFunction(0.5);
return AnimationInterpolator.cubicBezier(0.5, midPoint, 0.5, midPoint);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left custom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left easingFunction AST#identifier#Right AST#ERROR#Left AST#:#Le... | static custom(easingFunction: (t: number) => number): curves.ICurve {
const midPoint = easingFunction(0.5);
return AnimationInterpolator.cubicBezier(0.5, midPoint, 0.5, midPoint);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | b770b3309397c52a30ba6b4359f950401c76607b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets | arkts | printHelp | 打印使用帮助 | public static printHelp(): void {
const help = `
欢迎引导测试辅助工具 - 使用帮助
=====================================
1. 重置为首次启动:
await WelcomeGuideTestHelper.resetToFirstLaunch();
2. 完成引导:
await WelcomeGuideTestHelper.completeGuide();
3. 跳过引导:
await WelcomeGuideTestHelper.skipGuide();
4. 设置引导步骤:
await Welcome... | 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 printHelp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public static printHelp(): void {
const help = `
欢迎引导测试辅助工具 - 使用帮助
=====================================
1. 重置为首次启动:
await WelcomeGuideTestHelper.resetToFirstLaunch();
2. 完成引导:
await WelcomeGuideTestHelper.completeGuide();
3. 跳过引导:
await WelcomeGuideTestHelper.skipGuide();
4. 设置引导步骤:
await Welcome... | https://github.com/DaLongZhuaZi/manxia | 83eca30825532a54ad0c03ca1d495674439000a8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | toggleComicSourceStatus | 更新漫画源状态 | public async toggleComicSourceStatus(sourceId: string, isEnabled: boolean): Promise<void> {
try {
const updateData: ComicSourceUpdateData = {
id: sourceId,
isEnabled,
lastUpdateTime: Date.now()
};
// 这里需要实现图源状态切换的逻辑
logger.info(TAG, '切换图源状态', `${sourceId}: ${... | 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 toggleComicSourceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AS... | public async toggleComicSourceStatus(sourceId: string, isEnabled: boolean): Promise<void> {
try {
const updateData: ComicSourceUpdateData = {
id: sourceId,
isEnabled,
lastUpdateTime: Date.now()
};
// 这里需要实现图源状态切换的逻辑
logger.info(TAG, '切换图源状态', `${sourceId}: ${... | https://github.com/DaLongZhuaZi/manxia | 1d5c58349bef88b84df72eaccfdfd6e54805ff69 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarDataSet.ets | arkts | getBarBorderColor | Returns the color drawing borders around the bars.
@return | public getBarBorderColor(): number {
return this.mBarBorderColor;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBarBorderColor 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 A... | public getBarBorderColor(): number {
return this.mBarBorderColor;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 188d21ee5a79567c4c4d1d8aa421bc0b6b7dcec8 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BasePopup.ets | arkts | popupWidth | 弹窗宽度
@returns | popupWidth(): Length | undefined {
return undefined
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left popupWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier... | popupWidth(): Length | undefined {
return undefined
} | https://github.com/wuba/omni-ui | 662f8e92f68e4eb04bb8ff1ec9ecf5ec9dd085dd | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/XmlUtil.ets | arkts | getBoolValue | 从 XML 中获取布尔值
@param xml XML 字符串
@param tag 标签名
@returns 布尔值('1' 或 'true' 返回 true) | static getBoolValue(xml: string, tag: string): boolean {
const value = XmlUtil.getValue(xml, tag).toLowerCase();
return value === '1' || value === 'true';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBoolValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xml AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | static getBoolValue(xml: string, tag: string): boolean {
const value = XmlUtil.getValue(xml, tag).toLowerCase();
return value === '1' || value === 'true';
} | https://github.com/AlkaidLab/moonlight-harmony | a99f6b3442bbf94d126a454bcae1f6bcb415b554 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | getStats | ---------------------------------------------------------------------------
性能统计
---------------------------------------------------------------------------
获取实时性能统计 | getStats(): StreamStats {
try {
const vs = this.nativeModule.getVideoStats();
this.stats.decodedFrames = vs.framesDecoded;
this.stats.droppedFrames = vs.framesDropped;
this.stats.fps = vs.fps || 0;
this.stats.renderedFps = vs.renderedFps || 0;
this.stats.bitrate = vs.bitrate ||... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStats 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 StreamStats AST#identifier#Right AST#ERROR#Right AST#... | getStats(): StreamStats {
try {
const vs = this.nativeModule.getVideoStats();
this.stats.decodedFrames = vs.framesDecoded;
this.stats.droppedFrames = vs.framesDropped;
this.stats.fps = vs.fps || 0;
this.stats.renderedFps = vs.renderedFps || 0;
this.stats.bitrate = vs.bitrate ||... | https://github.com/AlkaidLab/moonlight-harmony | d225d087513512ec96c62f2207bda385dd7cc807 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/otp/OtpCompatibilityManager.ets | arkts | registerParser | 注册自定义解析器(用于扩展)
@param parser 解析器实例 | public registerParser(parser: IOtpFieldParser): void {
this.parsers.push(parser);
this.parsers.sort((a, b) => a.priority - b.priority);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerParser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left parser AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public registerParser(parser: IOtpFieldParser): void {
this.parsers.push(parser);
this.parsers.sort((a, b) => a.priority - b.priority);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/OtpCompatibilityManager.ets#L88-L91 | 9cec5dd69590a46331f5df3b8d73786d52a8ee7a | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setScaleEnabled | Set this to true to enable scaling (zooming in and out by gesture) for
the chart (this does not effect dragging) on both X- and Y-Axis.
@param enabled | public setScaleEnabled(enabled: boolean): void {
this.mScaleXEnabled = enabled;
this.mScaleYEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setScaleEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setScaleEnabled(enabled: boolean): void {
this.mScaleXEnabled = enabled;
this.mScaleYEnabled = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c8289eb068a20c678b24554d649efb1f89c31911 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/EntryOhos.ets | arkts | getX | Returns the x-value of this Entry object.
@return | public getX(): number {
return this.x;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getX AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public getX(): number {
return this.x;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ff96bd49720a83a443d9f28e40b37c6e0ef2b312 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | count | 执行查询并返回结果数量
@returns Promise<number> | async count(): Promise<number> {
return await this.withStoreLease(async () => {
this.ensureEntityQueryMode('COUNT')
const startTime = Date.now()
const subQueryContext = this.createSubQueryExecutionContext()
await DatabaseManager.getInstance().acquireQuerySlot()
try {
const st... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#L... | async count(): Promise<number> {
return await this.withStoreLease(async () => {
this.ensureEntityQueryMode('COUNT')
const startTime = Date.now()
const subQueryContext = this.createSubQueryExecutionContext()
await DatabaseManager.getInstance().acquireQuerySlot()
try {
const st... | https://github.com/offlinecat-dev/OCNetORM | e883798ca83c48307ca926d25e69b2ada202599f | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | videoSpeedTwo | 调节2.0倍速 | videoSpeedTwo(): void {
if (this.avPlayer) {
try {
this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X);
Logger.info(this.tag, 'videoSpeed_2_0');
} catch (e) {
Logger.info(this.tag, `videoSpeed_2_0 err : ${JSON.stringify(e)}`);
}
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left videoSpeedTwo 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#L... | videoSpeedTwo(): void {
if (this.avPlayer) {
try {
this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X);
Logger.info(this.tag, 'videoSpeed_2_0');
} catch (e) {
Logger.info(this.tag, `videoSpeed_2_0 err : ${JSON.stringify(e)}`);
}
}
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 416db325b680a43cb20c18018e1f29813da0baae | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnSliderViewModel.ets | arkts | setSliderValue2 | 设置滑块组件2的当前值
@param value 新的滑块值 | setSliderValue2(value: number): void {
this.sliderValue2 = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSliderValue2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ... | setSliderValue2(value: number): void {
this.sliderValue2 = value;
} | https://github.com/codelably/tuniao-ui | 6a6f33508cb45011846f566a0234492680be5595 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/service/AlgorithmService.ets | arkts | getComponentDetailData | 获取组件详情数据
@returns Promise<ComponentDetailModel[]> | public getComponentDetailData(): Promise<ComponentDetailModel[]> {
return this.getComponentDetailDataByLocal()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentDetailData 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#instantiation_e... | public getComponentDetailData(): Promise<ComponentDetailModel[]> {
return this.getComponentDetailDataByLocal()
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 443f513ef35978efbcb2b20698227e7f13faca60 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | reconstructPath | 重建路径
@param cameFrom 路径来源映射
@param current 当前节点 | private reconstructPath(
cameFrom: Map<string, string>,
current: GraphNode
): GraphNode[] {
const path: GraphNode[] = [current];
let nodeId: string | undefined = current.id;
while (nodeId !== undefined && cameFrom.has(nodeId)) {
const nextNodeId = cameFrom.get(nodeId);
if (nextNodeI... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reconstructPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left cameFrom AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | private reconstructPath(
cameFrom: Map<string, string>,
current: GraphNode
): GraphNode[] {
const path: GraphNode[] = [current];
let nodeId: string | undefined = current.id;
while (nodeId !== undefined && cameFrom.has(nodeId)) {
const nextNodeId = cameFrom.get(nodeId);
if (nextNodeI... | https://github.com/LJ666-ui/harmony-health-care | 2c93888288e4e5c435553b9e4083af8fa5cef5c3 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | setSeekTime | Slide the progress bar to set the playback progress.
@param value Value of the slider component.
@param mode Slider component change event. | setSeekTime(value: number, mode: SliderChangeMode) {
if (mode === Number(SliderMode.MOVING)) {
this.playerModel.progressVal = value;
this.playerModel.currentTime = DateFormatUtil.secondToTime(Math.floor(value * this.duration /
CommonConstants.ONE_HUNDRED / CommonConstants.A_THOUSAND));
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSeekTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ... | setSeekTime(value: number, mode: SliderChangeMode) {
if (mode === Number(SliderMode.MOVING)) {
this.playerModel.progressVal = value;
this.playerModel.currentTime = DateFormatUtil.secondToTime(Math.floor(value * this.duration /
CommonConstants.ONE_HUNDRED / CommonConstants.A_THOUSAND));
}
... | https://gitee.com/openharmony/codelabs.git | c4083e7d78d84fc88788e7d3d8e2e16cebbb38e8 | gitee |
XXYoLoong/SchoolSmart | entry/src/main/ets/components/indexpages/Main.ets | arkts | build | 构建主页面UI结构 | build() {
// 主垂直布局容器,按垂直方向排列各模块
Column() {
// 标题文本,展示系统名称
Text("ZZNJ·智慧校园系统\n")
.width("100%") // 标题宽度占满全屏
.height("5%") // 高度占屏幕5%
.textAlign(TextAlign.Center) // 标题文字居中显示
.fontSize("25fp") // 设置标题文字大小
// 搜... | 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() {
// 标题文本,展示系统名称
Text("ZZNJ·智慧校园系统\n")
.width("100%") // 标题宽度占满全屏
.height("5%") // 高度占屏幕5%
.textAlign(TextAlign.Center) // 标题文字居中显示
.fontSize("25fp") // 设置标题文字大小
// 搜... | https://github.com/XXYoLoong/SchoolSmart | 7965fbfa6880a44bbfb58f9e5f2cbcee5ee88f90 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/core/Controller.ets | arkts | showGuidePage | 显示组件对应的引导页 | private showGuidePage(): void {
if (this.observedPageIndex) {
this.observedPageIndex.setCurrentPageIndex(this.guidePageIndex);
}
if (this.builder && this.builder.pageChangedListener) {
this.builder.pageChangedListener.onPageChanged(this.guidePageIndex);
}
this.isGuideShowing = true;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showGuidePage 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#vo... | private showGuidePage(): void {
if (this.observedPageIndex) {
this.observedPageIndex.setCurrentPageIndex(this.guidePageIndex);
}
if (this.builder && this.builder.pageChangedListener) {
this.builder.pageChangedListener.onPageChanged(this.guidePageIndex);
}
this.isGuideShowing = true;
... | https://github.com/wuba/omni-ui | 54b1e53aa5e365e3fa843580159e17f9b4de3137 | github |
Jiagu1218/mrpohos | entry/src/main/ets/pages/Index.ets | arkts | copyPickerUriToMythroad | 将 DocumentPicker 返回的 URI 导入 mythroad。
依据 DevEco CodeGenie / 官方文档:用 FileUri 转成可 stat 的路径;整文件拷贝优先 fs.copyFileSync(fd, fd)(云上传示例),
避免 read/write 与 stat(fd) 在 Picker 资源上的不一致导致「大小校验失败」。 | async function copyPickerUriToMythroad(srcUri: string, sandboxPath: string): Promise<string> {
const mythroadDir = `${sandboxPath}/mythroad`;
if (!fs.accessSync(mythroadDir)) {
fs.mkdirSync(mythroadDir, true);
}
let baseName = mrpFileNameFromUri(srcUri);
if (baseName.length === 0 || !baseName.toLowerCase(... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left copyPickerUriToMythroad AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left srcUri AST#identifier#Rig... | async function copyPickerUriToMythroad(srcUri: string, sandboxPath: string): Promise<string> {
const mythroadDir = `${sandboxPath}/mythroad`;
if (!fs.accessSync(mythroadDir)) {
fs.mkdirSync(mythroadDir, true);
}
let baseName = mrpFileNameFromUri(srcUri);
if (baseName.length === 0 || !baseName.toLowerCase(... | https://github.com/Jiagu1218/mrpohos | 5ff4712c1932f4e51c08dbb5c04ae5ebdc9115ab | github |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | applyPatchStats | 统计增量更新 | private applyPatchStats(addDelta: number, delDelta: number, modDelta: number): void {
if (!this.diffResult) return;
const s = this.diffResult.stats;
s.addedCount = Math.max(0, s.addedCount + addDelta);
s.deletedCount = Math.max(0, s.deletedCount + delDelta);
s.modifiedCount = Math.max(0, s.modifie... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyPatchStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left addDelta AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | private applyPatchStats(addDelta: number, delDelta: number, modDelta: number): void {
if (!this.diffResult) return;
const s = this.diffResult.stats;
s.addedCount = Math.max(0, s.addedCount + addDelta);
s.deletedCount = Math.max(0, s.deletedCount + delDelta);
s.modifiedCount = Math.max(0, s.modifie... | https://github.com/XJTUWYD/ArkDiff | a16ee83b8b41f508400858375b390bd932c80e25 | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/ColorUtils.ets | arkts | parseColorString | 将十六进制颜色字符串解析为数字
@private | private parseColorString(colorStr: string): number | null {
if (colorStr.startsWith('#')) {
const hex = colorStr.slice(1);
if (hex.length === 8) { // #AARRGGBB
return parseInt(hex, 16);
} else if (hex.length === 6) { // #RRGGBB,默认不透明
return 0xFF000000 | parseInt(hex, 16);
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseColorString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left colorStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private parseColorString(colorStr: string): number | null {
if (colorStr.startsWith('#')) {
const hex = colorStr.slice(1);
if (hex.length === 8) { // #AARRGGBB
return parseInt(hex, 16);
} else if (hex.length === 6) { // #RRGGBB,默认不透明
return 0xFF000000 | parseInt(hex, 16);
}... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/ColorUtils.ets#L33-L43 | baa290467f55b89e1a30f90131b4560bbae53a61 | github |
SummerKaze/HMOS-AppBundleNameForShared | entry/src/main/ets/utils/UrlUtils.ets | arkts | isValidAppGalleryUrl | 验证是否为有效的华为应用商店URL
@param url 待验证的URL字符串
@returns 如果是有效的华为应用商店URL返回true,否则返回false | static isValidAppGalleryUrl(url: string): boolean {
try {
return url.startsWith('https://appgallery.huawei.com/app/detail');
} catch (error) {
promptAction.showToast({
message: '验证URL时发生错误:' + error,
})
console.error('验证URL时发生错误:', error);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidAppGalleryUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static isValidAppGalleryUrl(url: string): boolean {
try {
return url.startsWith('https://appgallery.huawei.com/app/detail');
} catch (error) {
promptAction.showToast({
message: '验证URL时发生错误:' + error,
})
console.error('验证URL时发生错误:', error);
return false;
}
} | https://github.com/SummerKaze/HMOS-AppBundleNameForShared | 8977cbc6a73dbaca9e20fb64e910c21b1a05633b | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/FormUtil.ets | arkts | notifyFormBindDataChanged | notify FormBindData Changed
@param formId formId
@param formBindData formBindData | public static async notifyFormBindDataChanged(formId: string, formBindData: formBindingData.FormBindingData):
Promise<void> {
try {
LogUtil.info(TAG, `notifyFormBindDataChanged --> formId: ${formId}, formBindData = ${JSON.stringify(formBindData)}`);
formProvider.updateForm(formId, formBindData);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left notifyFormBindDataChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifi... | public static async notifyFormBindDataChanged(formId: string, formBindData: formBindingData.FormBindingData):
Promise<void> {
try {
LogUtil.info(TAG, `notifyFormBindDataChanged --> formId: ${formId}, formBindData = ${JSON.stringify(formBindData)}`);
formProvider.updateForm(formId, formBindData);
... | https://gitee.com/openharmony-sig/applications_clock.git | 21f5f2b5dcb873646f3dd3c221b0ce75b601777f | gitee |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets | arkts | calculateRiskFactors | 计算各项风险因子 | private static calculateRiskFactors(healthData: Map<string, HealthDataRecord[]>): RiskFactor[] {
const factors: RiskFactor[] = [];
// 血压风险
const bpRecords = healthData.get('blood_pressure') || [];
if (bpRecords.length > 0) {
const avgBP = bpRecords.reduce((sum, r) => sum + Number(r.value), ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateRiskFactors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left healthData A... | private static calculateRiskFactors(healthData: Map<string, HealthDataRecord[]>): RiskFactor[] {
const factors: RiskFactor[] = [];
// 血压风险
const bpRecords = healthData.get('blood_pressure') || [];
if (bpRecords.length > 0) {
const avgBP = bpRecords.reduce((sum, r) => sum + Number(r.value), ... | https://github.com/LJ666-ui/harmony-health-care | b4faa4e1036713cb256a006ee3e53cdede946d4d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | padStart | The padStart() method pads the current string with another string (multiple times, if needed)
until the resulting string reaches the given length.
The padding is applied from the start of the resulting string.
@returns This string if `length` >= `end`, and padded string of length exactly `end` otherwise | public padStart(end: number, ch: String): String {
throw new Error("not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | public padStart(end: number, ch: String): String {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c89238d84290e9cdea6e9cec8779811bd8fe4f11 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/AncientOCRService.ets | arkts | recognize | 识别图像中的文字
@param imageData 输入图像数据
@param params OCR参数
@returns OCR识别结果 | async recognize(imageData: ImageData, params?: OCRParams): Promise<OCRResult> {
console.info('[AncientOCRService] 开始OCR识别');
const startTime = Date.now();
// 模拟OCR识别
const textBlocks = this.generateMockTextBlocks();
const fullText = textBlocks.map((block: RecognizedText) => block.text).join('\n'... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left recognize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageData AST#identifier#Right AST#type_annotation#Left AST#... | async recognize(imageData: ImageData, params?: OCRParams): Promise<OCRResult> {
console.info('[AncientOCRService] 开始OCR识别');
const startTime = Date.now();
// 模拟OCR识别
const textBlocks = this.generateMockTextBlocks();
const fullText = textBlocks.map((block: RecognizedText) => block.text).join('\n'... | https://github.com/LJ666-ui/harmony-health-care | 7970accda4c01848a5e6774a01472ee18eb9a856 | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets | arkts | getMinZoomRatio | 获取支持的最小变焦范围 | public static getMinZoomRatio(captureSession: camera.PhotoSession | camera.VideoSession): number {
let minZoomRatio: number = -10;
try {
let zoomRatioRange: Array<number> = captureSession.getZoomRatioRange();
minZoomRatio = Math.min(...zoomRatioRange);
} catch (error) {
// 失败返回错误码error.c... | 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 getMinZoomRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left ... | public static getMinZoomRatio(captureSession: camera.PhotoSession | camera.VideoSession): number {
let minZoomRatio: number = -10;
try {
let zoomRatioRange: Array<number> = captureSession.getZoomRatioRange();
minZoomRatio = Math.min(...zoomRatioRange);
} catch (error) {
// 失败返回错误码error.c... | https://gitee.com/openharmony-sig/flutter_packages.git | 54f13e2ae359038b80e810bff6a839a68c16a522 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/components/ColorPickerDialog.ets | arkts | hsvToRgb | HSV颜色转RGB | function hsvToRgb(h: number, s: number, v: number): number[] {
let r: number = 0;
let g: number = 0;
let b: number = 0;
const i: number = Math.floor(h * 6);
const f: number = h * 6 - i;
const p: number = v * (1 - s);
const q: number = v * (1 - f * s);
const t: number = v * (1 - (1 - f) * s);
switch ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hsvToRgb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left h AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function hsvToRgb(h: number, s: number, v: number): number[] {
let r: number = 0;
let g: number = 0;
let b: number = 0;
const i: number = Math.floor(h * 6);
const f: number = h * 6 - i;
const p: number = v * (1 - s);
const q: number = v * (1 - f * s);
const t: number = v * (1 - (1 - f) * s);
switch ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/ColorPickerDialog.ets#L45-L78 | c54f0472ade67befbad0df94c8844b4667e31c96 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | initFileCache | 初始化文件缓存个数,大小,以及路径
@param context 上下文
@param size 设置最大图片缓存数量
@param maxDiskUsage 设置最大硬盘使用量
@param path 设置文件缓存的子目录 | async initFileCache(context: Context, size: number = 256, maxDiskUsage: number = 256 * 1024 * 1024,
path?: string): Promise<void> {
if (path === undefined) {
path = "ImageKnife";
}
return await nativeNode.initFileCache(context.filesDir, size, maxDiskUsage, path);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initFileCache AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AS... | async initFileCache(context: Context, size: number = 256, maxDiskUsage: number = 256 * 1024 * 1024,
path?: string): Promise<void> {
if (path === undefined) {
path = "ImageKnife";
}
return await nativeNode.initFileCache(context.filesDir, size, maxDiskUsage, path);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L78-L84 | 7d1450e48f91d975843434856b80bf011149f7c8 | gitcode |
Vsolon0401/MallShopping | features/shopcart/src/main/ets/components/ShopCart.ets | arkts | routerDetailPage | 跳转生成订单页面 | routerDetailPage<T>(productId: T) {
router.pushUrl({
url: 'pages/CommodityDetailPage',
params: { data: productId }
}).catch((err: Error) => {
Logger.error(JSON.stringify(err));
});
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left routerDetailPage AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#parenthesized_expression#Left AST#(#... | routerDetailPage<T>(productId: T) {
router.pushUrl({
url: 'pages/CommodityDetailPage',
params: { data: productId }
}).catch((err: Error) => {
Logger.error(JSON.stringify(err));
});
} | https://github.com/Vsolon0401/MallShopping | 40464d52a13fadcc77655cc31f7dcdfe16400133 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/PromptTemplateManager.ets | arkts | updatePerformanceMetrics | 更新模板性能指标 | updatePerformanceMetrics(templateId: string, metrics: Partial<PromptPerformanceMetrics>): void {
const templates: PromptTemplate[] = this.getTemplateHistory(templateId);
if (templates.length === 0) {
return;
}
const latestTemplate: PromptTemplate = templates[templates.length - 1];
if (lates... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updatePerformanceMetrics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left templateId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | updatePerformanceMetrics(templateId: string, metrics: Partial<PromptPerformanceMetrics>): void {
const templates: PromptTemplate[] = this.getTemplateHistory(templateId);
if (templates.length === 0) {
return;
}
const latestTemplate: PromptTemplate = templates[templates.length - 1];
if (lates... | https://github.com/CLMC2025/Vignette | 7992631c9bb5895cbf2c72ceb7eb391f00b5ab95 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsBackupService.ets | arkts | disableAutoBackup | 关闭自动备份 | static async disableAutoBackup(): Promise<void> {
const uri = await PreferencesUtil.get<string>(AUTO_BACKUP_URI_KEY, '');
if (uri) {
try {
await fileShare.revokePermission([{
uri: uri,
operationMode: fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE,
... | 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 disableAutoBackup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | static async disableAutoBackup(): Promise<void> {
const uri = await PreferencesUtil.get<string>(AUTO_BACKUP_URI_KEY, '');
if (uri) {
try {
await fileShare.revokePermission([{
uri: uri,
operationMode: fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE,
... | https://github.com/AlkaidLab/moonlight-harmony | b7034a70872589e773963f952ab3c4c32eb25884 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.