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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | setOptPrefix | Sets the 'optPrefix'.
@param prefix the new value of 'optPrefix' | public setOptPrefix(prefix:string):void {
this.defaultOptPrefix = prefix;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOptPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left prefix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public setOptPrefix(prefix:string):void {
this.defaultOptPrefix = prefix;
} | https://gitee.com/openharmony-sig/commons-cli.git | 0394e22ff80e70e0689ba4ed87e1fc16968e43a1 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/ClipboardUtils.ets | arkts | copy | 复制文本到剪贴板
@param text 文本
@param timeoutClear 自动清理时间,单位秒, 小于等于0则不进行清理 | public static copy(text: string, timeoutClear?: number) {
// 获取系统剪贴板实例
const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
// 将数据写入剪贴板
pasteboard.getSystemPasteboard().setData(pasteboardData, (error, data) => {
if (error) {
hilog.error(DOMAIN, TAG, 'Failed... | AST#program#Left AST#expression_statement#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 copy AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | public static copy(text: string, timeoutClear?: number) {
// 获取系统剪贴板实例
const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
// 将数据写入剪贴板
pasteboard.getSystemPasteboard().setData(pasteboardData, (error, data) => {
if (error) {
hilog.error(DOMAIN, TAG, 'Failed... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ClipboardUtils.ets#L28-L44 | 3363b02bffd40b4a8c7b9e474b7f021b7faccb96 | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t19_encoderDecoder | T19: Custom encoder/decoder | t19_encoderDecoder(): void {
const customDecoder: (str: string, _dd: Object, _charset: string, _kind: string) => string =
(str: string, _dd: Object, _charset: string, kind: string): string => {
if (kind === 'key') { return str; }
return 'hello world';
};
const popts: ParseOptions =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t19_encoderDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement... | t19_encoderDecoder(): void {
const customDecoder: (str: string, _dd: Object, _charset: string, _kind: string) => string =
(str: string, _dd: Object, _charset: string, kind: string): string => {
if (kind === 'key') { return str; }
return 'hello world';
};
const popts: ParseOptions =... | https://github.com/wgli-collab/qs-arkts | 11c7a7808aa4569a08cda66230e2b5444da652e6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | getRequiredHeightSpace | This is for HorizontalBarChart vertical spacing.
@param p
@return | public getRequiredHeightSpace(p: Paint): number {
p.setTextSize(this.mTextSize);
let label: string = super.getLongestLabel();
return Utils.getLabelTextSize(p, label, this.textSizeCache).height + super.getYOffset() * 2;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRequiredHeightSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public getRequiredHeightSpace(p: Paint): number {
p.setTextSize(this.mTextSize);
let label: string = super.getLongestLabel();
return Utils.getLabelTextSize(p, label, this.textSizeCache).height + super.getYOffset() * 2;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5ac619d828c21c12b717e6bff4c3acf8ee0b92be | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | searchInPage | Search in page. | searchInPage() {
try {
this.controller?.searchAllAsync(this.inputSearchKey);
this.isSearching = true;
this.searchedSearchKey = this.inputSearchKey || '';
meow(`Submit in-page search for [${this.inputSearchKey}]!`, 'meowTabInfo][searchInPage', meowLevel.INFO);
} catch (e) {
meow(`... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchInPage 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 ... | searchInPage() {
try {
this.controller?.searchAllAsync(this.inputSearchKey);
this.isSearching = true;
this.searchedSearchKey = this.inputSearchKey || '';
meow(`Submit in-page search for [${this.inputSearchKey}]!`, 'meowTabInfo][searchInPage', meowLevel.INFO);
} catch (e) {
meow(`... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 83db9c0fb9b9981d94d6893cc19e743cd2772b66 | github |
ibestservices/ibest-ui | library/src/main/ets/components/numberKeyboard/index.ets | arkts | init | 初始化键盘 | init(){
if (this.styleType == 'default') {
this.keysList = this.genDefaultKeys()
} else {
this.keysList = this.genCustomKeys()
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init 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#if_statement#Left AST#if#Left if... | init(){
if (this.styleType == 'default') {
this.keysList = this.genDefaultKeys()
} else {
this.keysList = this.genCustomKeys()
}
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/numberKeyboard/index.ets#L114-L120 | f8d1248c3c91253959a9f4c372bd27b96ce4dae2 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | canUndo | ==================== Undo/Redo ====================
判断当前是否有可撤销的操作 | get canUndo(): boolean {
return this.undoStack.length > 0;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left canUndo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right ... | get canUndo(): boolean {
return this.undoStack.length > 0;
} | https://github.com/XJTUWYD/ArkDiff | e800e87a41100237f1f6ec1c00b8290488d7dfc5 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicDownloadService.ets | arkts | startSystemDownload | 使用系统下载管理器下载 | private async startSystemDownload(
url: string,
fileName: string,
filePath: string,
taskInfo: DownloadTaskInfo,
onProgress?: (progress: number) => void,
onComplete?: () => void,
onFail?: (error: string) => void
): Promise<void> {
try {
console.info('[Download] 使用系统下载管理器');
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startSystemDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ide... | private async startSystemDownload(
url: string,
fileName: string,
filePath: string,
taskInfo: DownloadTaskInfo,
onProgress?: (progress: number) => void,
onComplete?: () => void,
onFail?: (error: string) => void
): Promise<void> {
try {
console.info('[Download] 使用系统下载管理器');
... | https://github.com/cpdd5201314/harmonyOS-music-app | 7bd82e606661436fcd3264439e7be0f15212a9cc | github |
arkui-x/samples | CodeLab/Cases/common/routermodule/src/main/ets/interceptor/Interceptor.ets | arkts | interceptor | 公共拦截器逻辑
@param appUri 接收传过来的路由名
@param param 路由参数 | public static interceptor(appUri: string, param?: string): boolean {
// 循环拦截器容器中所有的子模块自定义的拦截函数
for (let i = 0; i < Interceptor.list.length; i++) {
if (Interceptor.list[i].executeFunction(appUri, param))
return true; // 如果子模块拦截函数返回true,即需要拦截
}
// 否则就放行
return false;
} | 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 interceptor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appUri AST#identifier#Right AST#:#Left : AS... | public static interceptor(appUri: string, param?: string): boolean {
// 循环拦截器容器中所有的子模块自定义的拦截函数
for (let i = 0; i < Interceptor.list.length; i++) {
if (Interceptor.list[i].executeFunction(appUri, param))
return true; // 如果子模块拦截函数返回true,即需要拦截
}
// 否则就放行
return false;
} | https://gitcode.com/arkui-x/samples | bc9ee332a85cdf28e2989f73c3fe3f78189c3097 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | subarray | Creates a Uint8ClampedArray with the same ArrayBuffer
@returns new Uint8ClampedArray with the same ArrayBuffer | public subarray(): Uint8ClampedArray {
return this.subarray(0, this.length)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Uint8ClampedA... | public subarray(): Uint8ClampedArray {
return this.subarray(0, this.length)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3416ea5088ee3cf13bf80ed244ccfa1bc9c3cb2b | gitee |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | totalAmount | 获取选中商品的总价
@returns {number} 总价(单位:分) | get totalAmount(): number {
let total = 0;
for (const cart of this.cartList) {
for (const spec of cart.spec) {
const key = `${cart.goodsId}_${spec.id}`;
if (this.selectedSpecIds.has(key)) {
total += spec.price * spec.count;
}
}
}
return total;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left totalAmount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right... | get totalAmount(): number {
let total = 0;
for (const cart of this.cartList) {
for (const spec of cart.spec) {
const key = `${cart.goodsId}_${spec.id}`;
if (this.selectedSpecIds.has(key)) {
total += spec.price * spec.count;
}
}
}
return total;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 863a0ac750309f23f2055b8c1189cf137cab1e73 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | scanExtractedFiles | 扫描解压缩后的文件
@param directory 目录路径
@param options 解压缩选项
@returns 文件信息列表 | private async scanExtractedFiles(
directory: string,
options: ExtractionOptions
): Promise<ExtractedFileInfo[]> {
const fileInfos: ExtractedFileInfo[] = [];
try {
const files = await this.sandboxManager.listDirectory(directory);
for (const fileName of files) {
const fileP... | 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 scanExtractedFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left directory AST#identifier#Right AST#ERROR#Left AST... | private async scanExtractedFiles(
directory: string,
options: ExtractionOptions
): Promise<ExtractedFileInfo[]> {
const fileInfos: ExtractedFileInfo[] = [];
try {
const files = await this.sandboxManager.listDirectory(directory);
for (const fileName of files) {
const fileP... | https://github.com/DaLongZhuaZi/manxia | 0ae5b331daa9829c46760ca871a3d448857ef530 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/CrashTracker.ets | arkts | writeLastCrashScenario | Write last crash scenario (durable, read by monitor after restart) | writeLastCrashScenario(scenario: string): void {
try {
const content = JSON.stringify({ scenario: scenario, ts: new Date().toISOString() });
const fd = fileIo.openSync(this.lastCrashPath,
fileIo.OpenMode.CREATE | fileIo.OpenMode.WRITE_ONLY | fileIo.OpenMode.TRUNC).fd;
fileIo.writeSync(fd... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeLastCrashScenario AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scenario AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef... | writeLastCrashScenario(scenario: string): void {
try {
const content = JSON.stringify({ scenario: scenario, ts: new Date().toISOString() });
const fd = fileIo.openSync(this.lastCrashPath,
fileIo.OpenMode.CREATE | fileIo.OpenMode.WRITE_ONLY | fileIo.OpenMode.TRUNC).fd;
fileIo.writeSync(fd... | https://github.com/AGenUI/AGenUI | 94158602103cff78ac0e4e35584dc0073cea13d1 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/SportService.ets | arkts | getReminderService | 获取提醒服务实例 | getReminderService(): ReminderService {
console.log('SportService.getReminderService - 返回的实例:', this.reminderService);
return this.reminderService;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getReminderService 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 ReminderService AST#identifier#Right AST#ER... | getReminderService(): ReminderService {
console.log('SportService.getReminderService - 返回的实例:', this.reminderService);
return this.reminderService;
} | https://gitcode.com/openharmony/codelabs | 8a9b5caf5bbd53842401a3dd50df138cddde623f | gitcode |
openharmony/codelabs | Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets | arkts | finish | video component finish callback | finish() {
this.isPlay = false;
this.isOpacity = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left finish 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#... | finish() {
this.isPlay = false;
this.isOpacity = false;
} | https://gitee.com/openharmony/codelabs.git | a576b092fbcea4022c78b9dc52321decb97f71c6 | gitee |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | getCenterOffsetY | 获取添加自身后的偏移量
@returns { number } | getCenterOffsetY(): number {
// 获取自身的一半
let widthHalf = this.width / 2;
return this.offsetY + widthHalf
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCenterOffsetY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#state... | getCenterOffsetY(): number {
// 获取自身的一半
let widthHalf = this.width / 2;
return this.offsetY + widthHalf
} | https://gitcode.com/arkui-x/samples | bfbe34ea013c05d358cdb76f3da698f2b7c8e871 | gitcode |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertFuel | FUEL ECONOMY
mpg and km/L are inversely related to L/100km — needs special (non-linear) handling. | static convertFuel(value: number, from: FuelUnit, to: FuelUnit): number {
if (from === to || value === 0) {
return value;
}
// Step 1: convert to L/100km
let l100: number;
if (from === FuelUnit.L_PER_100KM) {
l100 = value;
} else if (from === FuelUnit.KM_PER_L) {
l100 = 100 ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertFuel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static convertFuel(value: number, from: FuelUnit, to: FuelUnit): number {
if (from === to || value === 0) {
return value;
}
// Step 1: convert to L/100km
let l100: number;
if (from === FuelUnit.L_PER_100KM) {
l100 = value;
} else if (from === FuelUnit.KM_PER_L) {
l100 = 100 ... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | 987f30275677a1765d3676299e5ee0c6aac8eebf | github |
wodekouwei/qlog | qloglib/src/main/ets/qlog/xlog/LogFileUtil.ets | arkts | getLogZipNameByAccount | 获取log压缩后的文件名
<p>
其中末尾的数字是为了防止打包速度过快,文件名重复引起覆盖
@param account 账号 | public static getLogZipNameByAccount(account: string): string {
let packageName = AppUtils.getBundleName()
return packageName
+ LogFileUtil.ZIP_NAME_SEPARATOR
+ ConstantsUtils.HARMONY
+ LogFileUtil.ZIP_NAME_SEPARATOR
+ account
+ LogFileUtil.ZIP_NAME_SEPARATOR
+ Date.now()
... | 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 getLogZipNameByAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left account AST#identifier#Right AST#ERROR#Left AST... | public static getLogZipNameByAccount(account: string): string {
let packageName = AppUtils.getBundleName()
return packageName
+ LogFileUtil.ZIP_NAME_SEPARATOR
+ ConstantsUtils.HARMONY
+ LogFileUtil.ZIP_NAME_SEPARATOR
+ account
+ LogFileUtil.ZIP_NAME_SEPARATOR
+ Date.now()
... | https://gitcode.com/wodekouwei/qlog | 5dbe55587af0f88491390e45ba5b42c4e8c3df2b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | loadPluginRegistry | 加载插件注册表 | private async loadPluginRegistry(): Promise<void> {
try {
const registryPath = `${this.sandboxManager.getDirectory('plugins')}/registry.json`;
// 先检查文件是否存在,避免不必要的错误日志
const fileExists = await this.sandboxManager.exists(registryPath);
if (!fileExists) {
logger.info(TAG, '插件注册... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadPluginRegistry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async loadPluginRegistry(): Promise<void> {
try {
const registryPath = `${this.sandboxManager.getDirectory('plugins')}/registry.json`;
// 先检查文件是否存在,避免不必要的错误日志
const fileExists = await this.sandboxManager.exists(registryPath);
if (!fileExists) {
logger.info(TAG, '插件注册... | https://github.com/DaLongZhuaZi/manxia | 14f541cdf290d3818a9b86b64e3a7c38cffb45e1 | github |
OpenHarmonyPCDeveloper/GitNext | entry/src/main/ets/utils/DebounceSingletonUtil.ets | arkts | startOperation | 标记某项操作开始(进入“运行中”状态) | public startOperation(operationName: string): void{
DebounceSingletonUtil.operationsLock.set(operationName, true);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startOperation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operationName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public startOperation(operationName: string): void{
DebounceSingletonUtil.operationsLock.set(operationName, true);
} | https://gitcode.com/OpenHarmonyPCDeveloper/GitNext | 429621e0aff1e0991ed3f38d2c28f0025d7746fa | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_int.ets | arkts | main | ---
desc: check prefix increment for integer operand
--- | function main(): void {
let value: int = {{v.value}}
let result: int = ++value
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: int = {{v.value}}
let result: int = ++value
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b72ea9ccd3e8b24d137b4021adc4cbe271365ece | gitee |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/RdbManager.ets | arkts | deletePlaylist | 删除歌单
注意:不仅要删除歌单本身,还要删除映射表中该歌单的所有记录 | async deletePlaylist(playlistId: number): Promise<boolean> {
if (!this.rdbStore) return false;
// 开启事务,确保两个删除操作要么都成功,要么都失败
this.rdbStore.beginTransaction();
try {
// 1. 删除映射表中的关联关系
let predicatesMap = new relationalStore.RdbPredicates(this.tableNameMap);
predicatesMap.equalTo('playl... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deletePlaylist AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playlistId AST#identifier#Right AST#type_anno... | async deletePlaylist(playlistId: number): Promise<boolean> {
if (!this.rdbStore) return false;
// 开启事务,确保两个删除操作要么都成功,要么都失败
this.rdbStore.beginTransaction();
try {
// 1. 删除映射表中的关联关系
let predicatesMap = new relationalStore.RdbPredicates(this.tableNameMap);
predicatesMap.equalTo('playl... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L270-L293 | 80e576d4c1f8c0b77e60fb83be0400f552a9021e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | dirxml | Prints an XML representation of an object to stdout
Currently outputs the object as-is
@param {Any} obj - The object to display as XML
@returns {void} | public dirxml(...obj: Any[]): void {
this.log(...obj)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left dirxml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST... | public dirxml(...obj: Any[]): void {
this.log(...obj)
} | https://gitcode.com/iop123123/arkts-static-skills | 1b6aa6dd4e350d2ddfeef598c303724bde5e4c05 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/SessionApi.ets | arkts | sendSystemCommand | sendSystemCommand
@summary Issues a system command to a client.
@param {SessionApiSendSystemCommandRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof SessionApi | public async sendSystemCommand(requestParameters: SessionApiSendSystemCommandRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.command)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/System/${requestParameters.command}`}... | 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 sendSystemCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right... | public async sendSystemCommand(requestParameters: SessionApiSendSystemCommandRequest): Promise<void> {
this.assertParam(requestParameters.sessionId)
this.assertParam(requestParameters.command)
return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/System/${requestParameters.command}`}... | https://github.com/OHPG/FinSdk | 619cdb0e1120fa2874a00026688a5347942a3b69 | github |
HarmonyOS_Samples/BestPracticeSnippets | ClickResponseOptimization/entry/src/main/ets/view/LoadingView.ets | arkts | startAnimation | [Start start_animation]
骨架图,通过渐显渐隐的方式呈现骨架动画 | startAnimation(): void {
this.getUIContext().animateTo(CommonConstants.SKELETON_ANIMATION, () => {
this.listOpacity = CommonConstants.HALF_OPACITY;
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | startAnimation(): void {
this.getUIContext().animateTo(CommonConstants.SKELETON_ANIMATION, () => {
this.listOpacity = CommonConstants.HALF_OPACITY;
});
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 45a1c7633e0de486295d7f74380f7b7be2984e26 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/DataSet.ets | arkts | toSimpleString | Returns a simple string representation of the DataSet with the type and
the number of Entries.
@return | public toSimpleString(): string {
let size = 0;
if (this.mEntries != null) {
size = this.mEntries.size();
}
let str: string = "DataSet, label: " + (!this.getLabel() ? "" : this.getLabel()) + ", entries: " + size + "\n";
return str
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSimpleString 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#... | public toSimpleString(): string {
let size = 0;
if (this.mEntries != null) {
size = this.mEntries.size();
}
let str: string = "DataSet, label: " + (!this.getLabel() ? "" : this.getLabel()) + ", entries: " + size + "\n";
return str
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 937b5b7cbb0c8c7261673b74ba8a544ace4a336a | gitee |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | defineQueryMapParameter | Define query map parameter metadata | static defineQueryMapParameter(paramIndex: number, target: Object, propertyKey: string | symbol): void {
let queryMapParams = this.getMetadata('retrofit:queryMapParams', target, propertyKey) as number[] || [];
queryMapParams.push(paramIndex);
this.defineMetadata('retrofit:queryMapParams', queryMapParams, ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left defineQueryMapParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left paramIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number... | static defineQueryMapParameter(paramIndex: number, target: Object, propertyKey: string | symbol): void {
let queryMapParams = this.getMetadata('retrofit:queryMapParams', target, propertyKey) as number[] || [];
queryMapParams.push(paramIndex);
this.defineMetadata('retrofit:queryMapParams', queryMapParams, ... | https://github.com/killetom/ktretrofit | 96640b6c3b51716f81049d012ba8443093f6c0d2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewNetworkTester.ets | arkts | testWebViewConnection | 执行WebView测试 | async testWebViewConnection(
url: string,
controller: webview.WebviewController,
customUserAgent?: string
): Promise<WebViewTestResult> {
logger.info(TAG, `🌐 开始WebView连接测试: ${url}`);
const startTime = Date.now();
const result: WebViewTestResult = {
success: false,
url: url
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testWebViewConnection AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Lef... | async testWebViewConnection(
url: string,
controller: webview.WebviewController,
customUserAgent?: string
): Promise<WebViewTestResult> {
logger.info(TAG, `🌐 开始WebView连接测试: ${url}`);
const startTime = Date.now();
const result: WebViewTestResult = {
success: false,
url: url
... | https://github.com/DaLongZhuaZi/manxia | 29739176cba2807e2baae292c6ec5b6f0934068c | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/NotificationDAO.ets | arkts | markAllAsRead | 标记用户所有通知为已读 | static async markAllAsRead(userId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `UPDATE notifications SET is_read = 1 WHERE user_id = ?`;
await store.executeSql(sql, [userId]);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left markAllAsRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A... | static async markAllAsRead(userId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `UPDATE notifications SET is_read = 1 WHERE user_id = ?`;
await store.executeSql(sql, [userId]);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2bddbff3a1760a05554b081a1440a078f81ada42 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | table | Displays an array of objects in tabular format
Converts the data to a DataFrame and renders it
@param {Any[]} data - Array of objects to display as a table
@returns {void} | public table(...data: Any[]): void {
if (data.length == 0) {
return
}
// Note(ivan-tyulyandin): unwrap from Array, workaround for 25264
// unwrap from Array
let dat = data[0]!
if (!Console.isTabularData(dat)) {
this.log(dat)
retur... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left table AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left dat... | public table(...data: Any[]): void {
if (data.length == 0) {
return
}
// Note(ivan-tyulyandin): unwrap from Array, workaround for 25264
// unwrap from Array
let dat = data[0]!
if (!Console.isTabularData(dat)) {
this.log(dat)
retur... | https://gitcode.com/iop123123/arkts-static-skills | a3a247fcac284beb4069d09fcb6641e43a4e955f | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsBackupService.ets | arkts | exportToFile | ── 手动导出/导入(通过 FilePicker)──
通过系统文件选择器导出设置到文件 | static async exportToFile(): Promise<boolean> {
try {
const json = await SettingsBackupService.exportAll();
// 加密备份数据
const encrypted = await CryptoService.encrypt(json);
const documentPicker = new picker.DocumentViewPicker();
const saveOptions = new picker.DocumentSaveOptions();
... | 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 exportToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async exportToFile(): Promise<boolean> {
try {
const json = await SettingsBackupService.exportAll();
// 加密备份数据
const encrypted = await CryptoService.encrypt(json);
const documentPicker = new picker.DocumentViewPicker();
const saveOptions = new picker.DocumentSaveOptions();
... | https://github.com/AlkaidLab/moonlight-harmony | 72c887ae40e4ac97ec0c376a7a99d4a09b161401 | github |
HarmonyCandies/extended_text | extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets | arkts | appendContent | 添加内容到 SpecialText | appendContent(value: string): void {
this._content += value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left appendContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ... | appendContent(value: string): void {
this._content += value;
} | https://github.com/HarmonyCandies/extended_text | b37ec3e915c6c1cf6a38751dfe0b8a774a65fc21 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | getCachedFilePath | 获取在线图片磁盘缓存文件路径。
这里复用内部 cache partition 规则,避免调用方复制图源特例逻辑。 | public async getCachedFilePath(url: string, options?: OnlineLoadOptions): Promise<string | null> {
try {
const diskCache = await this.getDiskCacheForRequest(options);
if (!diskCache || !diskCache.isInitialized()) {
return null;
}
const diskCacheUrl = this.buildDiskCacheUrl(url, opt... | 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 getCachedFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : ... | public async getCachedFilePath(url: string, options?: OnlineLoadOptions): Promise<string | null> {
try {
const diskCache = await this.getDiskCacheForRequest(options);
if (!diskCache || !diskCache.isInitialized()) {
return null;
}
const diskCacheUrl = this.buildDiskCacheUrl(url, opt... | https://github.com/DaLongZhuaZi/manxia | 4013f350fa7364012a4e1b1f7d81ac1129e59137 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/webview/WebDemo.ets | arkts | js2arkts | 用于演示 js 调用 arkts | js2arkts(name: string): string {
return `hello:${name}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left js2arkts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | js2arkts(name: string): string {
return `hello:${name}`;
} | https://github.com/webabcd/HarmonyDemo | fa52916005e7ea0d323ecca9db4a3ac551e36f73 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from startPos to endPos.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@param { int } start - start inde... | public copyWithin(target: int, start: int, end?: int): Uint8Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let count:... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int, start: int, end?: int): Uint8Array {
let arrayLength: int = this.lengthInt;
target = normalizeIndex(target, arrayLength);
start = normalizeIndex(start, arrayLength);
end = normalizeIndex(asIntOrDefault(end, arrayLength), arrayLength);
let count:... | https://gitcode.com/iop123123/arkts-static-skills | 85f8bb17b2ae3426c4e009cc9b8cf62e356dd32a | gitcode |
Vsolon0401/MallShopping | features/commoditydetail/src/main/ets/components/CommodityDetail.ets | arkts | fetchCollection | 获取收藏信息 | fetchCollection(productId: number) {
collectionService.fetchCollectionDetail(productId).then(res => {
this.favorite = res.data != null ? BarType.COLLECTION : BarType.CANCEL_COLLECTION
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fetchCollection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right ... | fetchCollection(productId: number) {
collectionService.fetchCollectionDetail(productId).then(res => {
this.favorite = res.data != null ? BarType.COLLECTION : BarType.CANCEL_COLLECTION
})
} | https://github.com/Vsolon0401/MallShopping | 320263af74ede0f2f533a4663cf1959d1ad76d90 | github |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | recycleNode | 回收节点
@param type 节点类型
@param node 节点Controller | public recycleNode(type: string, node: NodeItem) {
let offlineNodes: NodeItem[] = this.nodePool.get(type);
if (!offlineNodes) {
if (this.nodePool.length >= this.nodePoolConfig.typeCount) {
this.onlineNodeSet.remove(node);
Logger.warn(tag, `NodePool type count over limit: ${this.nodePoolC... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recycleNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | public recycleNode(type: string, node: NodeItem) {
let offlineNodes: NodeItem[] = this.nodePool.get(type);
if (!offlineNodes) {
if (this.nodePool.length >= this.nodePoolConfig.typeCount) {
this.onlineNodeSet.remove(node);
Logger.warn(tag, `NodePool type count over limit: ${this.nodePoolC... | https://gitee.com/openharmony-sig/node_pool.git | 9e63b0dd9d3e5fa76f9c10c870834ea769d35a68 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/GlobalContext.ets | arkts | performSelfCheck | 执行GlobalContext自检
@returns 自检是否通过 | function performSelfCheck(): boolean {
try {
logger.startup('GlobalContext', '自检开始', '执行GlobalContext模块自检');
// 检查1: 验证context是否存在且有效
if (!_context) {
logger.error('GlobalContext', '❌ 自检失败: context为null');
return false;
}
// 检查2: 验证context类型
if (typeof _context !== 'objec... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left performSelfCheck 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... | function performSelfCheck(): boolean {
try {
logger.startup('GlobalContext', '自检开始', '执行GlobalContext模块自检');
// 检查1: 验证context是否存在且有效
if (!_context) {
logger.error('GlobalContext', '❌ 自检失败: context为null');
return false;
}
// 检查2: 验证context类型
if (typeof _context !== 'objec... | https://github.com/DaLongZhuaZi/manxia | c808ddf9d97d74a0bee2c98803d25ce863bb3ea5 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/component/PullRequestItem.ets | arkts | build | 这条数据的PullRequest对象 | build() {
Column({ space: 8 }) {
Row() {
//pr标题
Text(this.pullRequest.title)
.fontSize(21)
.maxLines(1)
.fontColor($r('app.color.text_ultrastrong'))
Blank()
.width(8)
//pr标签
ForEach(this.pullRequest.tags, (item, index) => {
... | 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#call_expression#... | build() {
Column({ space: 8 }) {
Row() {
//pr标题
Text(this.pullRequest.title)
.fontSize(21)
.maxLines(1)
.fontColor($r('app.color.text_ultrastrong'))
Blank()
.width(8)
//pr标签
ForEach(this.pullRequest.tags, (item, index) => {
... | https://gitee.com/openharmony-sig/online_event.git | f9ed89d1006048a28cc975363b7dd1b289b89d80 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | parseFps | 解析帧率字符串 | private parseFps(fpsStr: string): number {
// 检查是否是自定义帧率
if (fpsStr.startsWith('自定义:')) {
const customFps = parseInt(fpsStr.split(':')[1]);
return isNaN(customFps) ? 60 : customFps;
}
switch (fpsStr) {
case '30 FPS':
return 30;
case '60 FPS':
return 60;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseFps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fpsStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | private parseFps(fpsStr: string): number {
// 检查是否是自定义帧率
if (fpsStr.startsWith('自定义:')) {
const customFps = parseInt(fpsStr.split(':')[1]);
return isNaN(customFps) ? 60 : customFps;
}
switch (fpsStr) {
case '30 FPS':
return 30;
case '60 FPS':
return 60;
... | https://github.com/AlkaidLab/moonlight-harmony | fc3782f3b45287272a7b5e6538d9466f1597e0de | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/videorecorder/components/VideoRecorder.ets | arkts | isPhotoResult | Helper method to determine if result is a photo | private isPhotoResult(filePath: string, mediaTypes: cameraPicker.PickerMediaType[]): boolean {
// If only photo type was requested, it's definitely a photo
if (mediaTypes.length === 1 && mediaTypes[0] === cameraPicker.PickerMediaType.PHOTO) {
return true;
}
// If only video type was request... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isPhotoResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | private isPhotoResult(filePath: string, mediaTypes: cameraPicker.PickerMediaType[]): boolean {
// If only photo type was requested, it's definitely a photo
if (mediaTypes.length === 1 && mediaTypes[0] === cameraPicker.PickerMediaType.PHOTO) {
return true;
}
// If only video type was request... | https://github.com/Tencent-RTC/TUIKit_Harmony | 71fe3c36852afe3e9fe7f32cefb9667ef08205b2 | github |
OHPG/FinVideo | entry/src/main/ets/data/Repository.ets | arkts | onPlaybackStopped | 播放停止
@param id
@param position
@returns | public onPlaybackStopped(id: string, position: number): Promise<void> {
return this.requireApi().onPlaybackStopped(id, position)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onPlaybackStopped 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 ... | public onPlaybackStopped(id: string, position: number): Promise<void> {
return this.requireApi().onPlaybackStopped(id, position)
} | https://github.com/OHPG/FinVideo | bcbe22115e5460508ea9d17d6eba7a66b6a9e480 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test28_original_index.ets | arkts | makeAdder | --- Curried function pattern --- | function makeAdder(x: number): (n: number) => number {
let addX: (n: number) => number = (n: number): number => {
return x + n;
};
return addX;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeAdder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function makeAdder(x: number): (n: number) => number {
let addX: (n: number) => number = (n: number): number => {
return x + n;
};
return addX;
} | https://github.com/miaochiahao/ark-ghidra | 83de018f3777d8f2e7a7b51dd4f9c1f8b447b3b3 | github |
wuba/omni-ui | omni_component/src/main/ets/components/expandabletext/OmniExpandableText.ets | arkts | handleBr | 特殊处理换行符 | handleBr(rawHtml: string) {
const brStr = '<br>'
while (rawHtml.search(brStr) > 0) {
rawHtml = rawHtml.replace('<br>', `\n`)
}
return rawHtml
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleBr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rawHtml AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef... | handleBr(rawHtml: string) {
const brStr = '<br>'
while (rawHtml.search(brStr) > 0) {
rawHtml = rawHtml.replace('<br>', `\n`)
}
return rawHtml
} | https://github.com/wuba/omni-ui | 018eb14cf638f529afeb8231f77e1656d21bd247 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/DownloadManager.ets | arkts | processResponseData | 处理响应数据 | private async processResponseData(
reader: ReadableStreamDefaultReader<Uint8Array>,
file: fileIo.File,
task: DownloadTask,
lastUpdateTime: number,
lastDownloadedSize: number
) {
try {
while (true) {
const { done, value } = await reader.read();
if (done) break;
... | 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 processResponseData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reader AST#identifier#Right AST#:... | private async processResponseData(
reader: ReadableStreamDefaultReader<Uint8Array>,
file: fileIo.File,
task: DownloadTask,
lastUpdateTime: number,
lastDownloadedSize: number
) {
try {
while (true) {
const { done, value } = await reader.read();
if (done) break;
... | https://github.com/AetheriumSimulator/qemu-hmos | ea51896a88aa00ab7a4e0d623e29bb5256e6e1dc | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo5.ets | arkts | <arrow> | 自定义 ForEach() 的键值生成逻辑
根据打印的日志理解
点击本例的按钮,在位置 0 处添加一项,不会导致其他 item 的键值发生变化
所以,实际开发时建议用每个 item 的唯一标识做键值 | (item: number) => item.toString()) | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#number#Left number AST#number#Right AST#predefined_type#Rig... | (item: number) => item.toString()) | https://github.com/webabcd/HarmonyDemo | cd0eb95ce5da694efda4d6ffceb5a21dc3ff2542 | github |
Cool_foolisher1/ArkTSRepository | MultiCalculator/features/calculator/src/main/ets/utils/CalculateUtil.ets | arkts | mulOrDiv | 乘法和除法运算 | mulOrDiv(arg1: string, arg2: string, symbol: string): number {
let mulFlag = (symbol === CommonConstants.MUL)
if (this.containScientificNotation(arg1) || this.containScientificNotation(arg2)) {
if (mulFlag) {
return Number(arg1) * Number(arg2)
}
return Number(arg1) / Number(arg2)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mulOrDiv AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arg1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#... | mulOrDiv(arg1: string, arg2: string, symbol: string): number {
let mulFlag = (symbol === CommonConstants.MUL)
if (this.containScientificNotation(arg1) || this.containScientificNotation(arg2)) {
if (mulFlag) {
return Number(arg1) * Number(arg2)
}
return Number(arg1) / Number(arg2)
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | f575d2efb99d94cea4016bffdc890bedaff4a445 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets | arkts | remainingCapacity | Returns the number of additional elements that this queue can ideally accept without blocking.
@returns { int } the capacity of the BlockingQueue. | override remainingCapacity(): int {
return this.capacitySize - this.size;
} | AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#Right AST#call_expression#Left AST#identifier#Left remainingCapacity 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#Lef... | override remainingCapacity(): int {
return this.capacitySize - this.size;
} | https://gitcode.com/iop123123/arkts-static-skills | 97b10ddabf3b9abc5aa85d3923ace81ecda8c44a | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getName | Returns name of type
@returns {string} type name
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override getName(): string {
return TypeAPI.getTypeName(this.cls)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left getName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public override getName(): string {
return TypeAPI.getTypeName(this.cls)
} | https://gitcode.com/iop123123/arkts-static-skills | 761c4ec36c82f75a9e61203751eaf3c09b4f0e29 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | isNonGamepadDevice | 检查是否是非手柄设备 | private isNonGamepadDevice(nameLower: string, sources: inputDevice.SourceType[]): boolean {
// 智能判断:名称含手柄关键词时(如 "gamesir g8+ keyboard"),即使有 keyboard source 也视为手柄
const hasGamepadKeyword = GAMEPAD_NAME_KEYWORDS.some(kw => nameLower.includes(kw));
if (hasGamepadKeyword) return false;
// 名称或 source 匹配非手柄... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isNonGamepadDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left nameLower AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | private isNonGamepadDevice(nameLower: string, sources: inputDevice.SourceType[]): boolean {
// 智能判断:名称含手柄关键词时(如 "gamesir g8+ keyboard"),即使有 keyboard source 也视为手柄
const hasGamepadKeyword = GAMEPAD_NAME_KEYWORDS.some(kw => nameLower.includes(kw));
if (hasGamepadKeyword) return false;
// 名称或 source 匹配非手柄... | https://github.com/AlkaidLab/moonlight-harmony | 61a150c461a9a69b0f325f7fe0dcadad25e11b34 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | getRemoteMediaTrackIds | 获取 Rust 端的轨道 ID 列表 | public getRemoteMediaTrackIds(): string[] {
if (!this.client) return [];
return this.client.getMediaTracks();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRemoteMediaTrackIds 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... | public getRemoteMediaTrackIds(): string[] {
if (!this.client) return [];
return this.client.getMediaTracks();
} | https://github.com/tdcare/tdwebrtc | ca58138d5329addeb267823c967db4feecbdae71 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | checkPerformanceWarnings | 检查性能警告 | private checkPerformanceWarnings(): void {
const currentTime = Date.now();
// 检查帧率
if (this.metrics.frameRate.current < this.thresholds.minFPS) {
this.addWarning({
type: PerformanceWarningType.LOW_FPS,
message: `Low frame rate: ${typeof this.metrics.frameRate.current === 'number' ? ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkPerformanceWarnings 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 ... | private checkPerformanceWarnings(): void {
const currentTime = Date.now();
// 检查帧率
if (this.metrics.frameRate.current < this.thresholds.minFPS) {
this.addWarning({
type: PerformanceWarningType.LOW_FPS,
message: `Low frame rate: ${typeof this.metrics.frameRate.current === 'number' ? ... | https://github.com/DaLongZhuaZi/manxia | bf8462eb9a767c35b6d05cdfcad74e514ff2199b | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ReminderManager.ets | arkts | cancelAllReminders | 取消所有提醒 | async cancelAllReminders(): Promise<boolean> {
try {
await notificationManager.cancelAll();
console.info('取消所有提醒成功');
return true;
} catch (error) {
console.error('取消所有提醒失败:', JSON.stringify(error));
return false;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cancelAllReminders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g... | async cancelAllReminders(): Promise<boolean> {
try {
await notificationManager.cancelAll();
console.info('取消所有提醒成功');
return true;
} catch (error) {
console.error('取消所有提醒失败:', JSON.stringify(error));
return false;
}
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 752acc72c3674f7c631e6c2c4540e8b0aa595612 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/AITaskService.ets | arkts | isValidTitle | 验证标题有效性 | private isValidTitle(title: string): boolean {
if (title === '') {
return false
}
// 不能全是标点符号
const punctuationOnly = /^[\s\p{P}]+$/u
if (punctuationOnly.test(title)) {
return false
}
return true
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isValidTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private isValidTitle(title: string): boolean {
if (title === '') {
return false
}
// 不能全是标点符号
const punctuationOnly = /^[\s\p{P}]+$/u
if (punctuationOnly.test(title)) {
return false
}
return true
} | https://github.com/LongLiveY96/chatcube | 40d0adbf56cfdac825c95731378638849eaddbc0 | github |
honjow/Next2V | shared/src/main/ets/settings/SettingsBootstrap.ets | arkts | reapplyFromStore | Re-apply the store-backed settings into AppStorage / live state holders after a backup import
has written them directly into the unified store. Mirrors loadAll's settings restores, but
deliberately skips cookie jar, multi-account, the startup check-in trigger, and the network
proxy: those are runtime/credential surface... | static async reapplyFromStore(context: common.UIAbilityContext): Promise<void> {
BlockedListSettings.setContext(context)
let settingsStore: SettingsPreferencesStore | undefined = undefined
try {
settingsStore = await preferences.getPreferences(context, STORE_NAME_SETTINGS)
} catch (_error) {
... | 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 reapplyFromStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left... | static async reapplyFromStore(context: common.UIAbilityContext): Promise<void> {
BlockedListSettings.setContext(context)
let settingsStore: SettingsPreferencesStore | undefined = undefined
try {
settingsStore = await preferences.getPreferences(context, STORE_NAME_SETTINGS)
} catch (_error) {
... | https://github.com/honjow/Next2V | ac2b1d28029e8d84b40a3662ac9b9c28ffb1d65f | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/DatabaseHelper.ets | arkts | addColumn | 添加新列(用于数据库升级)
@param tableName 表名
@param columnName 列名
@param columnType 列类型 | async addColumn(tableName: string, columnName: string, columnType: string): Promise<void> {
if (!this.rdbStore) {
Logger.error(this.LOG_TAG, 'RdbStore is null, cannot add column');
return;
}
try {
const sql = `ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${columnType}`;
await... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left addColumn AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AST#... | async addColumn(tableName: string, columnName: string, columnType: string): Promise<void> {
if (!this.rdbStore) {
Logger.error(this.LOG_TAG, 'RdbStore is null, cannot add column');
return;
}
try {
const sql = `ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${columnType}`;
await... | https://github.com/Kira-Yagami-Light/Kira-Projects | 30572af9b20987d2a727be2c2ef7b98dc821631c | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | getConfig | 获取配置
@param key 配置键
@returns 配置值,如果键不存在则返回 undefined | static getConfig(key: string): ConfigValue | undefined {
return MelonDSNative.native.getConfig(key);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static getConfig(key: string): ConfigValue | undefined {
return MelonDSNative.native.getConfig(key);
} | https://github.com/richshaw2015/nds | ec1b6e2eee5172bdefd994dd12a21ab94ddfd769 | github |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/AudioUtils.ets | arkts | getProgress | 获取播放进度 | getProgress(): AudioProgress {
if (!this.player) {
return { position: 0, duration: 0 } as AudioProgress;
}
return {
position: this.player.currentTime,
duration: this.player.duration
} as AudioProgress;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProgress 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 AudioProgress AST#identifier#Right AST#ERROR#Right... | getProgress(): AudioProgress {
if (!this.player) {
return { position: 0, duration: 0 } as AudioProgress;
}
return {
position: this.player.currentTime,
duration: this.player.duration
} as AudioProgress;
} | https://github.com/Coke0807/NewsAPP-HarmonyOS | a38157c25ec262f8108b4aec5e35974fa2a219ab | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | scheduleReconnect | ---- 断线重连 ---- | private scheduleReconnect(): void {
this.stopHeartbeat();
if (this.reconnectTimer !== null) return;
const delay = PING_MIN_TIME + Math.floor(Math.random() * (PING_MAX_TIME - PING_MIN_TIME));
LogUtil.info(`${TAG} ${delay}ms 后尝试重连`);
this.reconnectTimer = setTimeout(() => {
this.reconnectTime... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleReconnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#e... | private scheduleReconnect(): void {
this.stopHeartbeat();
if (this.reconnectTimer !== null) return;
const delay = PING_MIN_TIME + Math.floor(Math.random() * (PING_MAX_TIME - PING_MIN_TIME));
LogUtil.info(`${TAG} ${delay}ms 后尝试重连`);
this.reconnectTimer = setTimeout(() => {
this.reconnectTime... | https://github.com/tdcare/tdwebrtc | d46d1050b839b1c5cb71763935183f40e0dcdafd | github |
Vsolon0401/MallShopping | features/home/src/main/ets/components/Home.ets | arkts | routerToSearch | 点击搜索栏进入搜索页 | routerToSearch() {
router.pushUrl({
url: 'pages/SearchCommodityPage'
}).catch((err: Error) => {
Logger.error(JSON.stringify(err));
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left routerToSearch 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#Lef... | routerToSearch() {
router.pushUrl({
url: 'pages/SearchCommodityPage'
}).catch((err: Error) => {
Logger.error(JSON.stringify(err));
});
} | https://github.com/Vsolon0401/MallShopping | 6ebae47e190fbdf2433a5e83db8a6507eba119b0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | dialogTransparency | 获取对话框透明度 | public get dialogTransparency(): number {
return this.currentProfile.transparency.dialog;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left dialogTransparency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public get dialogTransparency(): number {
return this.currentProfile.transparency.dialog;
} | https://github.com/DaLongZhuaZi/manxia | f9b5b082bd6f61b7bab19f7dcf8ca2b11e16bb02 | github |
arkui-x/samples | CodeLab/Cases/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets | arkts | getListOffset | MyScroller获取List组件的yOffset | getListOffset(): number {
return this.listScroller.currentOffset().yOffset;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getListOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statemen... | getListOffset(): number {
return this.listScroller.currentOffset().yOffset;
} | https://gitcode.com/arkui-x/samples | 6604765645398bcdf96f667c978d5f887880d8a9 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an iterable object.
@param { Iterable<number> } arrayLike - An iterable object to convert to an array.
@param { function } [mapfn] - A mapping function to call on every element of the array.
@returns { Uint32Array } - A new Uint32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Uint32Array {
if (mapfn == undefined) {
mapfn = (v: number, k: number): number => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code section i... | 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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie... | public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Uint32Array {
if (mapfn == undefined) {
mapfn = (v: number, k: number): number => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code section i... | https://gitcode.com/iop123123/arkts-static-skills | 6899dd8ae26bc89e90a998aa6b99b1ef26a3ceb4 | gitcode |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videoplaycomponents/XComponentVideo.ets | arkts | onChangePlay | isPlaying状态变化时调用 | onChangePlay() {
logger.info(TAG, 'onChangePlay:' + this.isPlaying);
this.isPlaying ? this.Play() : this.Pause();
this.videoPlayListener?.onPlayStatus(this.isPlaying);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onChangePlay 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 ... | onChangePlay() {
logger.info(TAG, 'onChangePlay:' + this.isPlaying);
this.isPlaying ? this.Play() : this.Pause();
this.videoPlayListener?.onPlayStatus(this.isPlaying);
} | https://github.com/openharmony/applications_app_samples | 7c290c01bc54a3aacb8b2619b06232dc841beaaa | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FollowManager.ets | arkts | getFollowingCount | Get following count (number of people this user is following)
优先从服务器获取 | static async getFollowingCount(username: string, userId?: number): Promise<number> {
try {
// 服务器模式下优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await FollowApi.getStats(userId);
console.info(`FollowManager: getStats response code=${response.code}`);
if (... | 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 getFollowingCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Le... | static async getFollowingCount(username: string, userId?: number): Promise<number> {
try {
// 服务器模式下优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await FollowApi.getStats(userId);
console.info(`FollowManager: getStats response code=${response.code}`);
if (... | https://github.com/Harrisonls2004/WaterFlow | 9c1223ea9bbe12fec83be446e98917b672fe5310 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | includes | Determines whether Uint8ClampedArray includes a certain element, returning true or false as appropriate
@param { int } searchElement - The element to search for. The search starts at index 0.
@returns { boolean } - true if searchElement is in Uint8ClampedArray, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAnd... | public includes(searchElement: int): boolean {
return this.indexOf(searchElement.toInt(), 0) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi... | public includes(searchElement: int): boolean {
return this.indexOf(searchElement.toInt(), 0) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | 6c802300f8a448624cdbcd81e4ab466ddadf296f | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/model/MusicAppState.ets | arkts | resolveSongAtQueueIndex | Resolves a {@link SongItem} for the given queue index without keeping a full table in memory.
@param queueIndex Index into playQueueIds.
@returns A song item, or undefined if the index is out of range. | public resolveSongAtQueueIndex(queueIndex: number): SongItem | undefined {
const ids = this.playQueueIds;
if (queueIndex < 0 || queueIndex >= ids.length) {
return undefined;
}
const dto = MusicDbApi.getInstance().getSongById(ids[queueIndex]);
return dto !== undefined ? SongDtoMapper.toSongIt... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resolveSongAtQueueIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left queueIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number... | public resolveSongAtQueueIndex(queueIndex: number): SongItem | undefined {
const ids = this.playQueueIds;
if (queueIndex < 0 || queueIndex >= ids.length) {
return undefined;
}
const dto = MusicDbApi.getInstance().getSongById(ids[queueIndex]);
return dto !== undefined ? SongDtoMapper.toSongIt... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 8c04a94f08230a0a944198161e7f3b47b9526f1a | gitcode |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets | arkts | seedMockBinding | Seed the mock server's `_active_bindings` set so the family-packs
endpoint accepts the deterministic device JWT. Idempotent: calling
twice is identical to calling once. Mirrors `BoundDeviceInfoFlow`'s
`seedMockBinding` helper but is duplicated here so the suite stays
self-contained vs. ordering changes in `List.test.et... | async function seedMockBinding(): Promise<void> {
try {
const body: string =
`{"device_id":"ui-mock-pack-suite","short_code":"${MOCK_VALID_SHORT_CODE}"}`;
await mockHttp(http.RequestMethod.POST, '/api/v1/public/pair/redeem', body, '');
} catch (err) {
throw err as Error;
}
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left seedMockBinding AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST... | async function seedMockBinding(): Promise<void> {
try {
const body: string =
`{"device_id":"ui-mock-pack-suite","short_code":"${MOCK_VALID_SHORT_CODE}"}`;
await mockHttp(http.RequestMethod.POST, '/api/v1/public/pair/redeem', body, '');
} catch (err) {
throw err as Error;
}
} | https://github.com/terryma2024/happyword | 2df9f78954cf405adcd08e2d37e787716de1d1f2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TarPackager.ets | arkts | serializeTarHeader | 序列化 tar 文件头为 512 字节的 ArrayBuffer | private serializeTarHeader(header: TarHeader): ArrayBuffer {
const buffer = new ArrayBuffer(512);
const view = new Uint8Array(buffer);
// 填充字段
this.writeString(view, 0, header.name, 100);
this.writeString(view, 100, header.mode, 8);
this.writeString(view, 108, header.uid, 8);
this.wri... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left serializeTarHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left header AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private serializeTarHeader(header: TarHeader): ArrayBuffer {
const buffer = new ArrayBuffer(512);
const view = new Uint8Array(buffer);
// 填充字段
this.writeString(view, 0, header.name, 100);
this.writeString(view, 100, header.mode, 8);
this.writeString(view, 108, header.uid, 8);
this.wri... | https://github.com/DaLongZhuaZi/manxia | 8c9e449b0fb06f1ef96816b7f839325b4bb4255e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | format | Formats a number according to the locale and formatting options of this Intl.NumberFormat object.
@param value A long to format.
@returns string representing the given number formatted according to the locale and formatting options of this Intl.NumberFormat object. | public format(value: long): string {
return this.formatLong(value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left format AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#Righ... | public format(value: long): string {
return this.formatLong(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 3fb3fdc88854dde8f1365aa750270d266cd0414b | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/downloads/classes/meowDawnloada.ets | arkts | meowItemOf | Get the meowDawnloadaItem of a webview.WebDownloadItem.
@param webDlItem The webview.WebDownloadItem.
@returns The meowDawnloadaItem or undefined if not found (Which indicates a bug). | private meowItemOf(webDlItem: webview.WebDownloadItem): meowDawnloadaItem | undefined {
for (const meowItem of this.items) {
if (meowItem.item.getGuid() === webDlItem.getGuid()) {
return meowItem;
}
}
return undefined;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left meowItemOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left webDlItem AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | private meowItemOf(webDlItem: webview.WebDownloadItem): meowDawnloadaItem | undefined {
for (const meowItem of this.items) {
if (meowItem.item.getGuid() === webDlItem.getGuid()) {
return meowItem;
}
}
return undefined;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | e605069c9dfda0e805e7e3bfb749d8cd29369a45 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoadResult.ets | arkts | getSuccessCount | 获取成功的关联数量
@returns 成功数量 | getSuccessCount(): number {
let count = 0
for (let i = 0; i < this.results.length; i++) {
if (this.results[i].success) {
count++
}
}
return count
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSuccessCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statem... | getSuccessCount(): number {
let count = 0
for (let i = 0; i < this.results.length; i++) {
if (this.results[i].success) {
count++
}
}
return count
} | https://github.com/offlinecat-dev/OCNetORM | 670b5b27da7858952d71a61867564a6e3be12d53 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test33_original_index.ets | arkts | testRecordTraversal | === Round 33: Record traversal, string methods combination,
array slice/splice, class with static factory + instance check,
error subclassing with re-throw, nested conditionals,
multiple assignment patterns, type coercion ===
--- Record traversal with Object.keys --- | function testRecordTraversal(): string {
let data: Record<string, string> = {};
data['name'] = 'Alice';
data['city'] = 'Shanghai';
data['lang'] = 'ArkTS';
let keys: string[] = Object.keys(data);
let result: string = '';
for (let i: number = 0; i < keys.length; i++) {
let key: string = keys[i];
let... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testRecordTraversal 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#predefi... | function testRecordTraversal(): string {
let data: Record<string, string> = {};
data['name'] = 'Alice';
data['city'] = 'Shanghai';
data['lang'] = 'ArkTS';
let keys: string[] = Object.keys(data);
let result: string = '';
for (let i: number = 0; i < keys.length; i++) {
let key: string = keys[i];
let... | https://github.com/miaochiahao/ark-ghidra | 77db5940e8cb915483e75f637a079a7a448858d6 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/component/VideoItemComponent/VideoItemComponent.ets | arkts | registerDataChangeListener | 公共方法实现 | registerDataChangeListener(listener: DataChangeListener): void {
this.listeners.push(listener)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#id... | registerDataChangeListener(listener: DataChangeListener): void {
this.listeners.push(listener)
} | https://github.com/Yebingiscn/SweetVideo | eaad9c64228881c803e946601e6ff5efdc8a276b | github |
openharmony/arkui_ace_engine | examples/Accessibility/AccessibilityCapi/entry/src/main/ets/pages/Index.ets | arkts | switchToCurrentScenario | 切换到当前场景 | switchToCurrentScenario(): void {
try {
nativerender.scenarioManager.switchScenario(this.xComponentId, this.scenarioId);
console.info(`Switched to scenario: ${this.scenarioId}`);
} catch (error) {
console.error('Failed to switch scenario:', JSON.stringify(error));
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switchToCurrentScenario AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stat... | switchToCurrentScenario(): void {
try {
nativerender.scenarioManager.switchScenario(this.xComponentId, this.scenarioId);
console.info(`Switched to scenario: ${this.scenarioId}`);
} catch (error) {
console.error('Failed to switch scenario:', JSON.stringify(error));
}
} | https://gitcode.com/openharmony/arkui_ace_engine | 45c781430b44e4195965adc1d3dba30015e653b4 | gitcode |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/TikTokChatStore.ets | arkts | delOneTiktokVideoComment | 删除一条视频的一条评论
@param videoId 视频id
@param messageId 评论的id | async delOneTiktokVideoComment(videoId: string, messageId: number) {
const store = this.getVideoStore(videoId)
const list = this.getOneTiktokVideoAllComment(videoId)
const index = list.findIndex(item => item.id === messageId)
list.splice(index, 1)
store.putSync(videoId, JSON.stringify(list))
a... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delOneTiktokVideoComment AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left videoId AST#identifier#Right AST#type_annotation#Left ... | async delOneTiktokVideoComment(videoId: string, messageId: number) {
const store = this.getVideoStore(videoId)
const list = this.getOneTiktokVideoAllComment(videoId)
const index = list.findIndex(item => item.id === messageId)
list.splice(index, 1)
store.putSync(videoId, JSON.stringify(list))
a... | https://github.com/SMAT-Lab/PhantomRendering | dcda3d9681ce2e8b49c9cf7a5f038881a05845af | github |
apap6628114/nga_oh | entry/src/main/ets/store/SettingsStore.ets | arkts | addBlacklist | ============== Facade: 兼容转发 setter ==============
--- Blacklist (SocialList) --- | addBlacklist(entry: BlacklistEntry): void { this.socialListSettings.addBlacklist(entry) } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addBlacklist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BlacklistEntry AST#identifier#Right AST#)#... | addBlacklist(entry: BlacklistEntry): void { this.socialListSettings.addBlacklist(entry) } | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L119-L119 | 75167c4033b48f73f212f35619692bc89419f78e | github |
arkui-x/samples | CodeLab/Cases/common/utils/src/main/ets/utils/NWebUtils.ets | arkts | WebBuilder | Builder中为动态组件的具体组件内容
调用onActive,开启渲染 | @Builder
function WebBuilder(data: Data) {
Web({ src: data.url, controller: data.controller })
.zoomAccess(true)
.verticalScrollBarAccess(false)
.javaScriptAccess(true)
.mixedMode(MixedMode.All)
.domStorageAccess(true)
.onPageBegin(() => {
if (PlatformInfo.getPlatform() === PlatformTypeE... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left WebBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requir... | @Builder
function WebBuilder(data: Data) {
Web({ src: data.url, controller: data.controller })
.zoomAccess(true)
.verticalScrollBarAccess(false)
.javaScriptAccess(true)
.mixedMode(MixedMode.All)
.domStorageAccess(true)
.onPageBegin(() => {
if (PlatformInfo.getPlatform() === PlatformTypeE... | https://gitcode.com/arkui-x/samples | fe818647a9ae6775ab553e606346da776f982681 | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/RemoteAssetCache.ets | arkts | hashUrl | FNV-1a 32-bit hash, hex-encoded (8 chars). We only need a stable
collision-resistant key for cache file names; cryptographic strength
is not required so we avoid pulling in @ohos.security.cryptoFramework. | private static hashUrl(url: string): string {
let h: number = 0x811c9dc5;
for (let i = 0; i < url.length; i++) {
h ^= url.charCodeAt(i);
h = Math.imul(h, 0x01000193) >>> 0;
}
return h.toString(16).padStart(8, '0');
} | 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 hashUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#... | private static hashUrl(url: string): string {
let h: number = 0x811c9dc5;
for (let i = 0; i < url.length; i++) {
h ^= url.charCodeAt(i);
h = Math.imul(h, 0x01000193) >>> 0;
}
return h.toString(16).padStart(8, '0');
} | https://github.com/terryma2024/happyword | be00a6877cea805330dd5b83248f7a63438e2d37 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/widgets/BottomPop.ets | arkts | isKeyboardAvoidNone | 弹窗是否在拉起软键盘时进行自动避让 | isKeyboardAvoidNone() {
return this.keyboardAvoidMode === KeyboardAvoidMode.NONE // 弹窗不避让软键盘
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isKeyboardAvoidNone 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_bloc... | isKeyboardAvoidNone() {
return this.keyboardAvoidMode === KeyboardAvoidMode.NONE // 弹窗不避让软键盘
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | f35a95a4a12dbe6573f80aa4e58e7ea80b8cd16c | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | origin | Gets the origin portion of the URL.
@return {string} Returns the origin portion of the URL. | get origin(): string {
let kOpaqueOrigin: string = 'null';
switch (this.cProtocol) {
case 'ftp:':
case 'gopher:':
case 'http:':
case 'https:':
case 'ws:':
case 'wss:':
retu... | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left origin 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#... | get origin(): string {
let kOpaqueOrigin: string = 'null';
switch (this.cProtocol) {
case 'ftp:':
case 'gopher:':
case 'http:':
case 'https:':
case 'ws:':
case 'wss:':
retu... | https://gitcode.com/iop123123/arkts-static-skills | b2c32cbc94fa0a7fa3e411a31ad2d33f57f142a8 | gitcode |
HarmonyOS_Samples/push-kit-sample-code-clientdemo-arkts | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | The input parameters want and launchParam are not actually used. They are defined during project initialization | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (err) {
hilog.error(0x0000, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err));
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (err) {
hilog.error(0x0000, 'testTag', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err));
... | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-clientdemo-arkts | 9d03440e8dec2b4d0bd0148ac6009d37aaec3b5e | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/JArrayList.ets | arkts | append | 在列表的末尾添加新元素
@param {*} element 要添加的元素 | append(element: T) {
this.dataSource[this.listSize++] = element;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Le... | append(element: T) {
this.dataSource[this.listSize++] = element;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | b7af3ae215c45d81b58bad26b6fd922dc3c3aad7 | gitee |
iichen-bycode/ArkTsWanandroid | entry/src/main/ets/viewmodel/HomeViewModel.ets | arkts | getHotSearchKeyArray | 搜索热词
@param callback | async getHotSearchKeyArray() {
await this.request()
.promise(getHotSearchKeys(),false)
.then((result) => {
this.hotSearchKeys = result
})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getHotSearchKeyArray 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 {... | async getHotSearchKeyArray() {
await this.request()
.promise(getHotSearchKeys(),false)
.then((result) => {
this.hotSearchKeys = result
})
} | https://github.com/iichen-bycode/ArkTsWanandroid | d3b46a80186c302b897bd8ed9cd317d5f1afb4cc | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | userBadges | 获取用户徽章 | static userBadges(username: string): string {
return `/user-badges/${username.toLowerCase()}.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left userBadges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | static userBadges(username: string): string {
return `/user-badges/${username.toLowerCase()}.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | b67754c68b58b2246f6be19cbc4438059419d0c5 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getHighlightsAtXValue | Returns a list of Highlight objects representing the entries closest to the given xVal.
The returned list contains two objects per DataSet (closest rounding up, closest rounding down).
@param xVal the transformed x-value of the x-touch position
@param x touch position
@param y touch position
@return | protected getHighlightsAtXValue(xVal: number, x: number, y: number): JArrayList<Highlight> | null {
this.mHighlightBuffer.clear();
let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> | null = this.getData();
if (data == null)
return this.mHighlightBuffer;
... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getHighlightsAtXValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xVal AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i... | protected getHighlightsAtXValue(xVal: number, x: number, y: number): JArrayList<Highlight> | null {
this.mHighlightBuffer.clear();
let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> | null = this.getData();
if (data == null)
return this.mHighlightBuffer;
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 8e45a81e2a2d3245d658e5b7fccaefa4c0f9822c | gitee |
PollenWang6/HiXD | entry/src/main/ets/services/SchoolnetService.ets | arkts | startZfwLogin | 获取登录页,提取 CSRF token 和 RSA 公钥
对齐 Flutter: GET /login → 解析 <input> 标签 | async startZfwLogin(): Promise<ZfwLoginResult> {
// 清除旧 session,开始新的登录流程
await this.http.clearCookies('zfw.xidian.edu.cn');
// 调试:打印 clear 后 cookie 状态
const afterClear: string = this.http.getCookiesForDomain('zfw.xidian.edu.cn');
console.error(TAG + ' after-clear cookieLen=' + afterClear.length + ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startZfwLogin 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#generi... | async startZfwLogin(): Promise<ZfwLoginResult> {
// 清除旧 session,开始新的登录流程
await this.http.clearCookies('zfw.xidian.edu.cn');
// 调试:打印 clear 后 cookie 状态
const afterClear: string = this.http.getCookiesForDomain('zfw.xidian.edu.cn');
console.error(TAG + ' after-clear cookieLen=' + afterClear.length + ... | https://github.com/PollenWang6/HiXD | 1e22fda26ad8b76e34be4e41d88efb47cb413724 | github |
xiebyapps/ClipLink | entry/src/main/ets/utils/HashUtil.ets | arkts | stringToBytes | Convert string to byte array (UTF-8) | private static stringToBytes(str: string): number[] {
const bytes: number[] = [];
for (let i = 0; i < str.length; i++) {
const code = str.charCodeAt(i);
if (code <= 0x7f) {
bytes.push(code);
} else if (code <= 0x7ff) {
bytes.push(0xc0 | (code >> 6));
bytes.push(0x80 |... | 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 stringToBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : ... | private static stringToBytes(str: string): number[] {
const bytes: number[] = [];
for (let i = 0; i < str.length; i++) {
const code = str.charCodeAt(i);
if (code <= 0x7f) {
bytes.push(code);
} else if (code <= 0x7ff) {
bytes.push(0xc0 | (code >> 6));
bytes.push(0x80 |... | https://github.com/xiebyapps/ClipLink | 990678fbd3530faf51257c67832d28bbf5a9bcdb | github |
OHPG/FinVideo | entry/src/main/ets/data/Repository.ets | arkts | getLibraryList | 获取媒体库列表
@returns | public getLibraryList(): Promise<Array<FinItem>> {
return this.requireApi().getLibraryList()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLibraryList 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#express... | public getLibraryList(): Promise<Array<FinItem>> {
return this.requireApi().getLibraryList()
} | https://github.com/OHPG/FinVideo | d70b3a6c1db5cc8b0014fdc2341e03c197280c2c | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/TrendsPage.ets | arkts | calculateMax | 计算最大值 | calculateMax(): number {
const values = this.records.map(r => this.getValueFromRecord(r)).filter(v => v > 0);
return values.length > 0 ? Math.max(...values) : 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateMax AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement... | calculateMax(): number {
const values = this.records.map(r => this.getValueFromRecord(r)).filter(v => v > 0);
return values.length > 0 ? Math.max(...values) : 0;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 4f97a686066fae2b8e8ec7bcf96a9938de9b54f7 | github |
RoooyHe/toona-ohos | toona/src/main/ets/utils/AppLogger.ets | arkts | getLogger | 获取Logger实例
@param context 类对象或字符串 tag 名
@returns AppLoggerProxy | static getLogger<T extends Object>(context: T | string): AppLoggerProxy {
let key: string;
if (typeof context === 'string') {
key = context;
} else if (context && context.constructor) {
key = context.constructor.name;
} else {
key = 'Anonymous';
}
const existing = AppLogger.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left getLogger AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type_identifier#Left Object AST#type_identifier#Right AST... | static getLogger<T extends Object>(context: T | string): AppLoggerProxy {
let key: string;
if (typeof context === 'string') {
key = context;
} else if (context && context.constructor) {
key = context.constructor.name;
} else {
key = 'Anonymous';
}
const existing = AppLogger.... | https://github.com/RoooyHe/toona-ohos | 52dd550ed7f91bd1ecc068530666219ef3125e2d | github |
openharmony-sig/ohos_circle_indicator | library/src/main/ets/models/BannerModel.ets | arkts | setNotifyPlayListener | don't call from user
@param callback | setNotifyPlayListener(callback: (status: boolean) => void) {
this.notifyPlay = callback
} | AST#program#Left AST#ERROR#Left AST#identifier#Left setNotifyPlayListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identi... | setNotifyPlayListener(callback: (status: boolean) => void) {
this.notifyPlay = callback
} | https://gitee.com/openharmony-sig/ohos_circle_indicator.git | b5ddc6c956f37fdcb8a2231c1d9b0b3749582e4b | gitee |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/util/PlayerDataUtil.ets | arkts | songItemToTrackUi | Maps SongItem fields into PlayerTrackUi for presentation components. | private static songItemToTrackUi(song: SongItem): PlayerTrackUi {
const ui = new PlayerTrackUi();
ui.id = song.id;
ui.title = song.title;
ui.singer = song.singer;
ui.cover = song.label;
return ui;
} | 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 songItemToTrackUi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Le... | private static songItemToTrackUi(song: SongItem): PlayerTrackUi {
const ui = new PlayerTrackUi();
ui.id = song.id;
ui.title = song.title;
ui.singer = song.singer;
ui.cover = song.label;
return ui;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 94c7b59540cfe7f4e4bad6844ab82628dc3832c9 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | at | Takes an integer value and returns the item at that index,
allowing for positive and negative integers. Negative integers count back
from the last item in the array.
@param index Zero-based index of the array element to be returned.
Negative index counts back from the end of the array — if `index` < 0, index + `array.l... | public at(index: number): T | null {
return this.at(index as int)
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left at AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifie... | public at(index: number): T | null {
return this.at(index as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9b365dcdaccb0a4b070330ab3acd713b9531bdcf | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | getPodcastById | 根据ID查询单个播客 | async getPodcastById(podcastId: string): Promise<Podcast | null> {
if (!this.rdbStore) return null;
try {
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_PODCAST);
predicates.equalTo('id', podcastId);
const resultSet = await this.rdbStore.query(predicates);
let p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPodcastById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left podcastId AST#identifier#Right AST#type_annot... | async getPodcastById(podcastId: string): Promise<Podcast | null> {
if (!this.rdbStore) return null;
try {
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_PODCAST);
predicates.equalTo('id', podcastId);
const resultSet = await this.rdbStore.query(predicates);
let p... | https://github.com/pangpang20/antennaPodHM | 81ada77edaf3846eeca4a833709c1e095213610a | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_ubyte.ets | arkts | main | ---
desc: check greater operation for two unsigned bytes
--- | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a > b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a > b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e6d3ca2afdf4e99d83c904a656bad5672deaf7a3 | gitee |
honjow/Next2V | feature/node/src/main/ets/viewmodel/NodeViewModel.ets | arkts | setNodeTopicsWebCookie | Carry the current authenticated cookie into subsequent web node-topic loads (page 1 + load-more). | setNodeTopicsWebCookie(cookie: string): void {
this.nodeTopicsWebCookie = (cookie || '').trim()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setNodeTopicsWebCookie AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cookie AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | setNodeTopicsWebCookie(cookie: string): void {
this.nodeTopicsWebCookie = (cookie || '').trim()
} | https://github.com/honjow/Next2V | 52233d2199ad1a547b86d71733194f0c1fed7ff4 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkStash.ets | arkts | saveToDisk | Save bookmarks to disk. | private async saveToDisk() {
const startTime = Date.now();
const htmlText = await parseToHTMLConcurrent(this.root);
if (!htmlText) {
meow(`Failed to export HTML to documents. htmlText is empty!`, 'meowBookmarkStash][exportHTMLtoDocuments', meowLevel.WARN);
return;
}
await saveHybrid(th... | 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 saveToDisk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ER... | private async saveToDisk() {
const startTime = Date.now();
const htmlText = await parseToHTMLConcurrent(this.root);
if (!htmlText) {
meow(`Failed to export HTML to documents. htmlText is empty!`, 'meowBookmarkStash][exportHTMLtoDocuments', meowLevel.WARN);
return;
}
await saveHybrid(th... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 6e4ae551b846249022c4a278c93223c339137fba | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | final | Adds a new test to the test suite.
@param {string} name The test name.
@param {Function} callback The callback function containing the test body.
@throws {Error} Thrown when the test name is empty.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | final addTest(name: string, callback: VoidFunc): void {
this.addTest(new ArkTestSync(name, callback));
} | AST#program#Left AST#ERROR#Left AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left addTest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | final addTest(name: string, callback: VoidFunc): void {
this.addTest(new ArkTestSync(name, callback));
} | https://gitcode.com/iop123123/arkts-static-skills | 726afec39ca449f7f489fcd23d41d649d735d6fe | gitcode |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/VideoOperateUtil.ets | arkts | initSetting | 启动时初始化已保存的设置项 | static initSetting(context: common.UIAbilityContext) {
PermissionUtil.reqPermissionsFromUser(PermissionUtil.permissions, context)
Setting.backgroundImageSrc = SelectFileUtil.getImageUri()
Setting.backgroundDropBlur = Preferences.getBackgroundDropBlur(context)
if (Setting.backgroundDropBlur > 0 && Sett... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left initSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression... | static initSetting(context: common.UIAbilityContext) {
PermissionUtil.reqPermissionsFromUser(PermissionUtil.permissions, context)
Setting.backgroundImageSrc = SelectFileUtil.getImageUri()
Setting.backgroundDropBlur = Preferences.getBackgroundDropBlur(context)
if (Setting.backgroundDropBlur > 0 && Sett... | https://github.com/Yebingiscn/SweetVideo | 918a68c512f3492e7f1a66983f7801c3f8eab4d3 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.