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 |
|---|---|---|---|---|---|---|---|---|---|---|
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/MoonBridge.ets | arkts | getStageName | ==========================================================================
状态和统计
========================================================================== | getStageName(stage: number): string {
return nativeLib.getStageName(stage);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStageName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A... | getStageName(stage: number): string {
return nativeLib.getStageName(stage);
} | https://github.com/AlkaidLab/moonlight-harmony | 1288648864a44bb3cc8a65954c775d0cf6eb6cc6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Float64Array using range [begin, this.length).
@param begin start index to be taken into slice
@returns a new Float64Array with elements of current Float64Array[begin, this.length) | public slice(begin: number): Float64Array {
return this.slice(begin as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number): Float64Array {
return this.slice(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a9875a5ee556715334e75744e1dee7f8afaca709 | gitee |
openharmony-tpc/openharmony_tpc_samples | GSYVideoPlayer-filters/library/src/main/ets/components/mainpage/BaseVideoPlayer.ets | arkts | onPlayingStatus | 状态切换为正在播放 | public onPlayingStatus() {
this.playStatus = PlayStatus.PLAY;
this.onPlayingListener();
LogUtils.getInstance().LOGI('onPlayingStatus: ' + this.xComponentId);
let eventData: emitter.EventData = {
data: {
"xid": this.xComponentId
}
}
emitter.emit(this.videoPlayingEvent, event... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onPlayingStatus 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... | public onPlayingStatus() {
this.playStatus = PlayStatus.PLAY;
this.onPlayingListener();
LogUtils.getInstance().LOGI('onPlayingStatus: ' + this.xComponentId);
let eventData: emitter.EventData = {
data: {
"xid": this.xComponentId
}
}
emitter.emit(this.videoPlayingEvent, event... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 6504ba76ea2b9daf1ddde8b525785ea4864390dc | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an array-like object.
@param { ArrayLike<BigInt> } arr - An array-like object to convert to an array.
@returns { BigUint64Array } - A new BigUint64Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: ArrayLike<BigInt>): BigUint64Array {
throw new Error("BigUint64Array.from: not implemented");
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: ArrayLike<BigInt>): BigUint64Array {
throw new Error("BigUint64Array.from: not implemented");
} | https://gitcode.com/iop123123/arkts-static-skills | 877dc7625ab4d1c73f42937482f3c89144b67811 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets | arkts | build | [StartExclude opt_funcParam] | build() {
Column() {
Text(this.moment.text)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(500)
.lineHeight(24)
.fontColor(Color.Black)
.opacity(0.6)
Column() {
this.item();
this.item();
this.item(this.LAST_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#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Text(this.moment.text)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(500)
.lineHeight(24)
.fontColor(Color.Black)
.opacity(0.6)
Column() {
this.item();
this.item();
this.item(this.LAST_ITEM_INDEX);
... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 51742f3c3f0e25cae6216a04ff7d91992f37b5ee | gitcode |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getBodyTextFontSize | 获取正文字体大小 | static getBodyTextFontSize(): number {
return 16;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBodyTextFontSize 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... | static getBodyTextFontSize(): number {
return 16;
} | https://github.com/chendi126/harmonyOS-TCP | e1d6d090bc6e2a387bcee5615f1c693f051823fd | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | getNotifyOnComplete | 获取“完成时通知”开关 | async getNotifyOnComplete(): Promise<boolean> {
return await this.getBoolean(PreferenceKeys.NOTIFY_ON_COMPLETE, true)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNotifyOnComplete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | async getNotifyOnComplete(): Promise<boolean> {
return await this.getBoolean(PreferenceKeys.NOTIFY_ON_COMPLETE, true)
} | https://github.com/LongLiveY96/chatcube | 7039ff3804c3351df585869785df53b9132f9f04 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/DataMapper.ets | arkts | inferPropertyType | 根据列元数据推断属性类型
@param column 列元数据
@returns 属性类型标识 | private inferPropertyType(column: ColumnMetadata): string {
switch (column.columnType) {
case ColumnType.TEXT:
return 'string'
case ColumnType.INTEGER:
if (this.isDateColumn(column)) {
return 'Date'
}
if (this.isBooleanColumn(column)) {
return 'boole... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left inferPropertyType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private inferPropertyType(column: ColumnMetadata): string {
switch (column.columnType) {
case ColumnType.TEXT:
return 'string'
case ColumnType.INTEGER:
if (this.isDateColumn(column)) {
return 'Date'
}
if (this.isBooleanColumn(column)) {
return 'boole... | https://github.com/offlinecat-dev/OCNetORM | 5f5ae3658befb2b586f5d3f6fc2b0a54e09bd514 | github |
CsCesium/KantaiHomo | entry/src/main/ets/app/pages/components/panel/battle/BattlePreviewPanel.ets | arkts | build | ── main build ──────────────────────────────────────────────────────────── | build() {
Stack({ alignContent: Alignment.Center }) {
Column() {
if (this.resultSnap) {
// ── Result view ─────────────────────────────────────────────────
ForEach([this.battleRenderKey], (_key: string) => {
this.ResultContent()
}, (key: string): string => k... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack({ alignContent: Alignment.Center }) {
Column() {
if (this.resultSnap) {
// ── Result view ─────────────────────────────────────────────────
ForEach([this.battleRenderKey], (_key: string) => {
this.ResultContent()
}, (key: string): string => k... | https://github.com/CsCesium/KantaiHomo | d4ec1a8f57f5e81d33bb16484a7e235e6401bc08 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | info | Prints info-level messages
If first argument is a string it is treated as a format string
@param {...Any[]} vals - Variable number of values to be logged
@returns {void}
@public | public info(...vals: Any[]): void {
this.printRest(LogLevel.INFO, ...vals)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left info 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 vals... | public info(...vals: Any[]): void {
this.printRest(LogLevel.INFO, ...vals)
} | https://gitcode.com/iop123123/arkts-static-skills | 034cd9d00670f951315c8f1a01077fdd33d3ec6d | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsBackupService.ets | arkts | doAutoSave | 执行自动备份(静默写入已授权的文件) | private static async doAutoSave(): Promise<void> {
const uri = await PreferencesUtil.get<string>(AUTO_BACKUP_URI_KEY, '');
if (!uri) return;
try {
// 尝试激活持久化权限
try {
await fileShare.activatePermission([{
uri: uri,
operationMode: fileShare.OperationMode.READ_MODE | ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left doAutoSave AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#... | private static async doAutoSave(): Promise<void> {
const uri = await PreferencesUtil.get<string>(AUTO_BACKUP_URI_KEY, '');
if (!uri) return;
try {
// 尝试激活持久化权限
try {
await fileShare.activatePermission([{
uri: uri,
operationMode: fileShare.OperationMode.READ_MODE | ... | https://github.com/AlkaidLab/moonlight-harmony | 185f713b851ec866f851470634190aac5c7d7920 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | canonicalTagText | Display aliases can be "raw | translated"; EH search must use the raw first segment. | static canonicalTagText(tag: string): string {
const raw: string = tag.trim()
const pipe: number = raw.indexOf('|')
return pipe >= 0 ? raw.substring(0, pipe).trim() : raw
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left canonicalTagText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static canonicalTagText(tag: string): string {
const raw: string = tag.trim()
const pipe: number = raw.indexOf('|')
return pipe >= 0 ? raw.substring(0, pipe).trim() : raw
} | https://github.com/erosTeam/NextE | d2a62b60dc16384593b2a8d483dc7eaa6c3728a9 | github |
openharmony-sig/ohos_subsampling_scale_image_view | library/src/main/ets/components/MainPage/SubsamplingScaleImageView.ets | arkts | setOnStateChangedListener | Add a listener for pan and zoom events. Extend {@link DefaultOnStateChangedListener} to simplify
implementation.
@param onStateChangedListener an {@link OnStateChangedListener} instance. | public setOnStateChangedListener(onStateChangedListener: OnStateChangedListener): Model {
this.onStateChangedListener = onStateChangedListener;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnStateChangedListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left onStateChangedListener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public setOnStateChangedListener(onStateChangedListener: OnStateChangedListener): Model {
this.onStateChangedListener = onStateChangedListener;
return this;
} | https://gitee.com/openharmony-sig/ohos_subsampling_scale_image_view.git | fda427da688394478a0f40939ab47a96596568bc | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | equals | Checks for equality this instance with provided object, treated as a ArrayType
@param {Type} other type to be checked against
@returns {boolean} true if object also has ArrayType and
their element types are the same
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override equals(other: Type): boolean {
return other instanceof ArrayType && (other as ArrayType).getElementType().equals(this.getElementType())
} | 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 equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public override equals(other: Type): boolean {
return other instanceof ArrayType && (other as ArrayType).getElementType().equals(this.getElementType())
} | https://gitcode.com/iop123123/arkts-static-skills | 6f937b80596fc8e51c915ece40672775eb6fce85 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/BookTransitionOverlay.ets | arkts | cancelTransition | 取消过渡动画(带渐隐效果)
@param onCancel 取消完成后的回调 | public cancelTransition(onCancel?: () => void): void {
if (!this.currentState.isActive || this.isCancelling) {
return;
}
logger.info(TAG, '取消过渡动画(带渐隐效果)');
this.isCancelling = true;
this.onCancelCallback = onCancel || null;
// 清除待执行的导航
if (this.pendingNavigationTimer !== -1... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left cancelTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Lef... | public cancelTransition(onCancel?: () => void): void {
if (!this.currentState.isActive || this.isCancelling) {
return;
}
logger.info(TAG, '取消过渡动画(带渐隐效果)');
this.isCancelling = true;
this.onCancelCallback = onCancel || null;
// 清除待执行的导航
if (this.pendingNavigationTimer !== -1... | https://github.com/DaLongZhuaZi/manxia | 90d54c844a4ad9209501959520ca2c9f5cf52b74 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/PerformanceMonitor.ets | arkts | clearStats | 清除性能统计数据 | static clearStats(): void {
PerformanceMonitor.stats.clear();
console.log('[PerformanceMonitor] 性能统计数据已清除');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static clearStats(): void {
PerformanceMonitor.stats.clear();
console.log('[PerformanceMonitor] 性能统计数据已清除');
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ba63e782cdedde2548b41d619ecd7a31cfadad05 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/25.bitwise_and_logical_expressions/01.integer_bitwise_operators/integer_and.ets | arkts | main | ---
desc: Integer 'and' operation
params: {{i.xorigin}} {{i.op}} {{i.yorigin}} == {{i.dest}} ({{i.xbits}} {{i.op}} {{i.ybits}} == {{i.dbits}})
--- | function main(): void {
let x: byte = {{i.xorigin}};
let y: byte = {{i.yorigin}};
let dest: byte = {{i.dest}};
assert((x {{i.op}} y) == dest); | 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 x: byte = {{i.xorigin}};
let y: byte = {{i.yorigin}};
let dest: byte = {{i.dest}};
assert((x {{i.op}} y) == dest); | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 693d617acdb9c0d9319e0c0cde6284d6b4c95938 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | registerCustomFontsForCurrentUIContext | 在当前 UIContext 中重新注册所有自定义字体。
API23 的字体注册绑定 UIContext,冷启动初始化早于页面创建时需要在页面出现后重放注册。 | public async registerCustomFontsForCurrentUIContext(): Promise<void> {
await this.registerCustomFontsForUIContext(uiContextManager.getUIContext());
} | 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 registerCustomFontsForCurrentUIContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#cal... | public async registerCustomFontsForCurrentUIContext(): Promise<void> {
await this.registerCustomFontsForUIContext(uiContextManager.getUIContext());
} | https://github.com/DaLongZhuaZi/manxia | 3ea84e9b51d690cf6a7d8b4c6fbf78db807b7d1a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | initialize | 初始化缓存管理器 | public async initialize(config?: Partial<ImageCacheConfig>): Promise<void> {
try {
// 合并配置
if (config) {
this.config = this.mergeConfig(this.config, config);
}
// 初始化磁盘缓存索引
await this.initializeDiskCacheIndex();
// 启动定期清理
this.startCleanupTimer();
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#?#Left ? AST#... | public async initialize(config?: Partial<ImageCacheConfig>): Promise<void> {
try {
// 合并配置
if (config) {
this.config = this.mergeConfig(this.config, config);
}
// 初始化磁盘缓存索引
await this.initializeDiskCacheIndex();
// 启动定期清理
this.startCleanupTimer();
... | https://github.com/DaLongZhuaZi/manxia | 9fce0a5df72ce6462d37c3ec33652b0e1924fb5a | github |
HarmonyOS_Samples/BestPracticeSnippets | NdkDrawing/entry/src/main/ets/view/Index.ets | arkts | startDraw | Make a list of 1000 0-1 positions and draw circles at the corresponding positions | startDraw(): void {
this.pointsToDraw = [];
for (let index = 0; index < 1000; index++) {
this.pointsToDraw.push([Math.random(), Math.random()]);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startDraw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le... | startDraw(): void {
this.pointsToDraw = [];
for (let index = 0; index < 1000; index++) {
this.pointsToDraw.push([Math.random(), Math.random()]);
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 31badb7fcf4d65f19aba3f1c672e48a94e6b5a42 | gitcode |
CsCesium/KantaiHomo | entry/src/main/ets/features/alerts/executor.ets | arkts | handleSortieNext | 进入下一节点提醒(api_req_map/next 触发,适用于所有节点类型) | async function handleSortieNext(alert: SortieNextAlert): Promise<void> {
const config = getAlertBus().getConfig();
const fleetLabel = formatFleetLabel(alert.deckId, alert.combinedType);
const bossStr = alert.isBoss ? '[BOSS]' : '';
const taihaStr = alert.hasTaihaRisk ? ' - ⚠大破警告!' : '';
const cellLabel = form... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left handleSortieNext AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alert AST#identifier#Right AST#t... | async function handleSortieNext(alert: SortieNextAlert): Promise<void> {
const config = getAlertBus().getConfig();
const fleetLabel = formatFleetLabel(alert.deckId, alert.combinedType);
const bossStr = alert.isBoss ? '[BOSS]' : '';
const taihaStr = alert.hasTaihaRisk ? ' - ⚠大破警告!' : '';
const cellLabel = form... | https://github.com/CsCesium/KantaiHomo | f39ae0ce70a0926c42df68b6baa4542b8371f379 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/DiskCacheManager.ets | arkts | initialize | 初始化缓存目录和索引 | public async initialize(baseDir: string): Promise<void> {
if (this.initialized) {
return;
}
if (this.initPromise) {
return this.initPromise;
}
this.initPromise = this.doInitialize(baseDir);
await this.initPromise;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public async initialize(baseDir: string): Promise<void> {
if (this.initialized) {
return;
}
if (this.initPromise) {
return this.initPromise;
}
this.initPromise = this.doInitialize(baseDir);
await this.initPromise;
} | https://github.com/DaLongZhuaZi/manxia | 344d3b8f67e58da25d92cc16f54457a69e79a566 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | forEach | Performs the specified action for each element in Uint8ClampedArray
@param { function } callbackfn - A function that accepts up to three arguments. forEach calls the
callbackfn function one time for each element in the array.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public forEach(callbackfn: (value: number, index: int, array: Uint8ClampedArray) => void): void {
for (let i = 0; i < this.lengthInt; i++) {
callbackfn(this.getUnsafe(i).toDouble(), i, this)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | public forEach(callbackfn: (value: number, index: int, array: Uint8ClampedArray) => void): void {
for (let i = 0; i < this.lengthInt; i++) {
callbackfn(this.getUnsafe(i).toDouble(), i, this)
}
} | https://gitcode.com/iop123123/arkts-static-skills | 022da02d3af3437ad2b66df54a49168195ef8d99 | gitcode |
YANGZX22/Voot | entry/src/main/ets/services/SherpaWhisperMicService.ets | arkts | setSenseVoiceLanguage | 设置 SenseVoice 模型的语言
@param language 语言代码: 'zh', 'en', 'ja', 'ko', 'yue', 或 'auto' | setSenseVoiceLanguage(language: string): void {
this.senseVoiceLanguage = language;
if (this.enableDebugLogs) {
console.info(`[SherpaMic] SenseVoice language set to ${language}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSenseVoiceLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left language AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left... | setSenseVoiceLanguage(language: string): void {
this.senseVoiceLanguage = language;
if (this.enableDebugLogs) {
console.info(`[SherpaMic] SenseVoice language set to ${language}`);
}
} | https://github.com/YANGZX22/Voot | 1d8c8d5820fd3443310cfd031a6f4f4cf6ea2df5 | github |
dingzhilin1990/zhilinclaw | src/security/SecurityFilter.ets | arkts | calculateRiskLevel | 计算风险级别 | private calculateRiskLevel(score: number): RiskLevel {
if (score === 0) return RiskLevel.NONE;
if (score <= 2) return RiskLevel.LOW;
if (score <= 5) return RiskLevel.MEDIUM;
if (score <= 10) return RiskLevel.HIGH;
return RiskLevel.CRITICAL;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateRiskLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left score AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private calculateRiskLevel(score: number): RiskLevel {
if (score === 0) return RiskLevel.NONE;
if (score <= 2) return RiskLevel.LOW;
if (score <= 5) return RiskLevel.MEDIUM;
if (score <= 10) return RiskLevel.HIGH;
return RiskLevel.CRITICAL;
} | https://github.com/dingzhilin1990/zhilinclaw | 4873f9be05d7d3180a8d2ef034c549f346a674ae | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/pages/cacender.ets | arkts | updateStats | 更新统计数据 | updateStats(records: CoffeeRecord[]) {
const now = new Date()
const currentYear = now.getFullYear()
// 年度统计 - 计算今年已过的天数和剩余天数
const isLeapYear = (currentYear % 4 === 0 && currentYear % 100 !== 0) || (currentYear % 400 === 0)
const totalDaysInYear = isLeapYear ? 366 : 365
// 使用日期计算今天是第几天
c... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#L... | updateStats(records: CoffeeRecord[]) {
const now = new Date()
const currentYear = now.getFullYear()
// 年度统计 - 计算今年已过的天数和剩余天数
const isLeapYear = (currentYear % 4 === 0 && currentYear % 100 !== 0) || (currentYear % 400 === 0)
const totalDaysInYear = isLeapYear ? 366 : 365
// 使用日期计算今天是第几天
c... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | bbd400227f507a1fceccfb5aae917dd7918acfb1 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets | arkts | startInitialization | Starts initialization of the native system.
<p>This loads the Flutter engine's native library to enable subsequent JNI calls. This also
starts locating and unpacking Dart resources packaged in the app's APK.
<p>Calling this method multiple times has no effect.
@param applicationContext The Android application context.
... | async startInitialization(context: common.Context) {
Log.d(TAG, "flutterLoader start init")
this.initStartTimestampMillis = Date.now();
this.context = context;
this.flutterApplicationInfo = ApplicationInfoLoader.load(context);
await prefetchDefaultFontManager();
if (this.flutterApplicationInfo... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startInitialization AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#L... | async startInitialization(context: common.Context) {
Log.d(TAG, "flutterLoader start init")
this.initStartTimestampMillis = Date.now();
this.context = context;
this.flutterApplicationInfo = ApplicationInfoLoader.load(context);
await prefetchDefaultFontManager();
if (this.flutterApplicationInfo... | https://gitee.com/openharmony-sig/flutter_engine.git | 75427d30b5812cb3ecb21b1a45cef39c69c78ad5 | gitee |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | appendPostalsForDoCoMo | Tries to append just one line. If there's no appropriate address
information, append an empty line. | private appendPostalsForDoCoMo(iContact: contact.Contact): void {
let currentPriority: number = 1.79E+308;
let currentType: number = 1.79E+308;
let currentContentValues: contact.PostalAddress | null = null;
let postals = iContact.postalAddresses
if (postals) {
for... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendPostalsForDoCoMo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iContact AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#me... | private appendPostalsForDoCoMo(iContact: contact.Contact): void {
let currentPriority: number = 1.79E+308;
let currentType: number = 1.79E+308;
let currentContentValues: contact.PostalAddress | null = null;
let postals = iContact.postalAddresses
if (postals) {
for... | https://gitee.com/openharmony-tpc/VCard.git | 9280ba22ad088a1b7d678067c021f2d57489d848 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Float64Array using range [begin, end)
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sliceFromTo}
@param { int } [begin] - start index to be taken into slice
@param { int } [end] - last index to be taken into slice
@returns { Float64Array } ... | public slice(begin?: int, end?: int): Float64Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): Float64Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 731bdab31cdf217a379bc757b23de885ea8c79d9 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | hideConfirmReceiveDialog | 隐藏确认收货弹窗
@returns {void} 无返回值 | hideConfirmReceiveDialog(): void {
this.showConfirmDialog = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hideConfirmReceiveDialog 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#sta... | hideConfirmReceiveDialog(): void {
this.showConfirmDialog = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 726eeff52df544873b7e2f5869bdc194da50910d | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/MessageManager.ets | arkts | getConversations | Get all conversations for a user. | static async getConversations(currentUsername: string): Promise<IConversation[]> {
try {
// 优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await MessageApi.getConversations();
// 服务端返回成功时,即使数据为空也使用服务端结果(因为可能是用户删除了会话)
if (response.code === 200 && response.da... | 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 getConversations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentUsername AST#identifier#Right AST#ERROR#Left AS... | static async getConversations(currentUsername: string): Promise<IConversation[]> {
try {
// 优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await MessageApi.getConversations();
// 服务端返回成功时,即使数据为空也使用服务端结果(因为可能是用户删除了会话)
if (response.code === 200 && response.da... | https://github.com/Harrisonls2004/WaterFlow | bbed4c25c90e1bf5ff6764d4bddfc23e6bc7858f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | analyzeDirectionPreference | 分析翻页方向偏好 | private analyzeDirectionPreference(): number {
if (this.stats.totalPages === 0) {
return 0.8; // 默认假设主要向前翻页
}
return this.stats.forwardPages / this.stats.totalPages;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left analyzeDirectionPreference 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#L... | private analyzeDirectionPreference(): number {
if (this.stats.totalPages === 0) {
return 0.8; // 默认假设主要向前翻页
}
return this.stats.forwardPages / this.stats.totalPages;
} | https://github.com/DaLongZhuaZi/manxia | 2c7d6ef9b1c21376b7a769435fd14c75f905beeb | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/LegendRenderer.ets | arkts | computeLegend | Prepares the legend and calculates all needed forms, labels and colors.
@param data | public computeLegend(data ?: ChartData<IDataSet<EntryOhos>>): void {
if (this.mLegend && !this.mLegend.isLegendCustom() && data) {
this.computedEntries.clear();
// loop for building up the colors and labels used in the legend
for (let i: number = 0; i < data.getDataSetCount(); i++) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left computeLegend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | public computeLegend(data ?: ChartData<IDataSet<EntryOhos>>): void {
if (this.mLegend && !this.mLegend.isLegendCustom() && data) {
this.computedEntries.clear();
// loop for building up the colors and labels used in the legend
for (let i: number = 0; i < data.getDataSetCount(); i++) {
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ab37f16a4ef4105abce80e3e093e6fe5950c9a16 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets | arkts | resizable | Returns true if the ArrayBuffer can be resized.
@returns { boolean } True if the ArrayBuffer can be resized.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get resizable(): boolean {
return this.isResizable
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left resizable 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#Righ... | get resizable(): boolean {
return this.isResizable
} | https://gitcode.com/iop123123/arkts-static-skills | 4d352f7afadef58000f9432dc40a7e13122d55c7 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo6.ets | arkts | notifyDataChange | 通知 LazyForEach 组件,在位置 index 处的 item 发生了变化 | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDatasetChange([{type: DataOperationType.CHANGE, index: index}]);
// 上面的相当于下面的,但是在一个 IDataSource 内,onDatasetChange 和 onDataXXX 不能混用,否则可能会报错 Error: onDatasetChange cannot be used with other interface
// listene... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left... | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
listener.onDatasetChange([{type: DataOperationType.CHANGE, index: index}]);
// 上面的相当于下面的,但是在一个 IDataSource 内,onDatasetChange 和 onDataXXX 不能混用,否则可能会报错 Error: onDatasetChange cannot be used with other interface
// listene... | https://github.com/webabcd/HarmonyDemo | 139239cfdbb03a1cc7a5daedc24fbc1dc27ec6fd | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | getFileName | === 私有辅助方法 === | private getFileName(path: string): string {
const parts = path.split('/');
return parts[parts.length - 1] || 'unknown';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | private getFileName(path: string): string {
const parts = path.split('/');
return parts[parts.length - 1] || 'unknown';
} | https://github.com/AetheriumSimulator/qemu-hmos | 27452258425467711d66a86a046cb398ddd0204b | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/config/RouteConfigManager.ets | arkts | addRoutes | 批量添加路由
@param paths 路由路径数组 | public addRoutes(paths: string[]): void {
paths.forEach((path: string) => {
this.addRoute(path);
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addRoutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left paths AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#... | public addRoutes(paths: string[]): void {
paths.forEach((path: string) => {
this.addRoute(path);
});
} | https://github.com/LJ666-ui/harmony-health-care | f205052c7d03ddf3a18927c6f826dcc61d23ad40 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_files_manager_old.ets | arkts | get_dir | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
外部歌曲处理库 //
//////////////
读取文件夹 // | get_dir(path: string = ''): string[][] {
let dir_list: string[] = []
let file_list: string[] = []
// 文件夹扫描扫描
for (const i of fs.listFileSync(song_path + '/' + path, { recursion: false })) {
let tmp_path = song_path + '/' + path + '/' + i
// 文件夹
if(fs.statSync(tmp_path).isDirector... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left get_dir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left st... | get_dir(path: string = ''): string[][] {
let dir_list: string[] = []
let file_list: string[] = []
// 文件夹扫描扫描
for (const i of fs.listFileSync(song_path + '/' + path, { recursion: false })) {
let tmp_path = song_path + '/' + path + '/' + i
// 文件夹
if(fs.statSync(tmp_path).isDirector... | https://github.com/Nekofox-POT/LinMusic | e60badf04d7ada33eadf566d06f8c59f7b0b463f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/DeviceSensorService.ets | arkts | getGyroReportRate | 获取当前陀螺仪报告频率 | getGyroReportRate(): number {
return this.gyroReportRateHz;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGyroReportRate 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#stat... | getGyroReportRate(): number {
return this.gyroReportRateHz;
} | https://github.com/AlkaidLab/moonlight-harmony | 3cfe72d3ac5511afc93805a48d5b894e59c57a56 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | includes | Checks if specified argument is in Float32Array
@param e search element
@param fromIndex start index to search from
@returns true if e is in Float32Array, false otherwise | public includes(e: number, fromIndex: number): boolean {
return this.includes(e as double as int as float, fromIndex as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST... | public includes(e: number, fromIndex: number): boolean {
return this.includes(e as double as int as float, fromIndex as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fb33a5e4e1d1423eb06e4effc9d2a6eca86f51c7 | gitee |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordCheck.ets | arkts | getButtonVisibility | Get button visibility
@return : button visibility | getButtonVisibility(): Visibility {
return this.passwordType == PinSubType.PIN_SIX ? Visibility.Hidden : Visibility.Visible;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getButtonVisibility 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 Visibility AST#identifier#Right AST#ERROR#... | getButtonVisibility(): Visibility {
return this.passwordType == PinSubType.PIN_SIX ? Visibility.Hidden : Visibility.Visible;
} | https://gitee.com/openharmony/applications_settings.git | 72de1dbab0eabc4fc8146b5174e46475b6ae149b | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/utils/ChecksumHelper.ets | arkts | verifyChecksum | 验证校验和
@param data 要验证的数据
@param expectedChecksum 期望的校验和
@returns 是否匹配 | static async verifyChecksum(data: string, expectedChecksum: string): Promise<boolean> {
try {
ChecksumHelper.logInfo(`开始验证校验和`);
// 计算实际校验和
const actualChecksum = await ChecksumHelper.generateChecksum(data);
// 比较校验和(不区分大小写)
const isValid = actualChecksum.toLowerCase() === expected... | 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 verifyChecksum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AS... | static async verifyChecksum(data: string, expectedChecksum: string): Promise<boolean> {
try {
ChecksumHelper.logInfo(`开始验证校验和`);
// 计算实际校验和
const actualChecksum = await ChecksumHelper.generateChecksum(data);
// 比较校验和(不区分大小写)
const isValid = actualChecksum.toLowerCase() === expected... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8025d9df7f4129e54a1c991143306afb8e0c2edf | github |
RoooyHe/toona-ohos | toona/src/main/ets/database/LocalDatabase.ets | arkts | clearAllData | ── Utility ── | async clearAllData(): Promise<void> {
if (!this.messageDao || !this.roomDao || !this.userDao || !this.roomMemberDao) {
throw new Error('Database not initialized');
}
try {
await this.messageDao.deleteAll();
await this.roomDao.deleteAll();
await this.userDao.deleteAll();
awai... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearAllData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AS... | async clearAllData(): Promise<void> {
if (!this.messageDao || !this.roomDao || !this.userDao || !this.roomMemberDao) {
throw new Error('Database not initialized');
}
try {
await this.messageDao.deleteAll();
await this.roomDao.deleteAll();
await this.userDao.deleteAll();
awai... | https://github.com/RoooyHe/toona-ohos | 57aa44cb946d94667237dc997da550e8893e328f | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | printUsage | Print the cmdLineSyntax to the specified writer, using the specified width.
@param cmdLineSyntax The usage statement. | public printUsage(width: number, cmdLineSyntax: string, options ?: Options): void {
if (options) {
// initialize the string buffer
let buff: string = this.getSyntaxPrefix() + cmdLineSyntax + " ";
// create a list for processed option groups
let processedGroups: JList<OptionGroup> = new JLi... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left printUsage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public printUsage(width: number, cmdLineSyntax: string, options ?: Options): void {
if (options) {
// initialize the string buffer
let buff: string = this.getSyntaxPrefix() + cmdLineSyntax + " ";
// create a list for processed option groups
let processedGroups: JList<OptionGroup> = new JLi... | https://gitee.com/openharmony-sig/commons-cli.git | 01890f1611ca17d4475f371b6404e7f06d579afd | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/ParentApiClient.ets | arkts | listLessonDraftsByStatus | List drafts filtered by status. Server-side pagination is 1-indexed. | async listLessonDraftsByStatus(
statusFilter: string,
page: number,
size: number,
): Promise<LessonDraftListPage> {
const url: string =
`${this.lessonFamilyBase()}/lesson-drafts?status=${encodeURIComponent(statusFilter)}` +
`&page=${page}&size=${size}`;
const op: string = `listLesson... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listLessonDraftsByStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left statusFilter AST#identifier#Right AST#type_annotation#... | async listLessonDraftsByStatus(
statusFilter: string,
page: number,
size: number,
): Promise<LessonDraftListPage> {
const url: string =
`${this.lessonFamilyBase()}/lesson-drafts?status=${encodeURIComponent(statusFilter)}` +
`&page=${page}&size=${size}`;
const op: string = `listLesson... | https://github.com/terryma2024/happyword | 6d6ab261dcf1c079b2c0662d7477628ca886f70f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setGridBackgroundColor | Sets the color for the background of the chart-drawing area (everything
behind the grid lines).
@param color | public setGridBackgroundColor(color: string | number | CanvasGradient | CanvasPattern): void {
if (this.mGridBackgroundPaint) {
this.mGridBackgroundPaint.setColor(color);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setGridBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_e... | public setGridBackgroundColor(color: string | number | CanvasGradient | CanvasPattern): void {
if (this.mGridBackgroundPaint) {
this.mGridBackgroundPaint.setColor(color);
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 36e2ac15f4b5eabed864fd87e299706f915b4020 | gitee |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets | arkts | isConnected | 判断是否连接 | async isConnected(): Promise<boolean> {
if (!this.tcpSocket) {
return false;
}
try {
let state = await this.tcpSocket.getState();
if (state.isConnected) {
return true;
}
} catch (e) {
Logger.error(`${TAG} tcp getState error ${JSON.stringify(e)}}`);
}
retu... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left isConnected 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 isConnected(): Promise<boolean> {
if (!this.tcpSocket) {
return false;
}
try {
let state = await this.tcpSocket.getState();
if (state.isConnected) {
return true;
}
} catch (e) {
Logger.error(`${TAG} tcp getState error ${JSON.stringify(e)}}`);
}
retu... | https://github.com/openharmony/applications_app_samples | b3bfedf1d5785739537947cd8ed01edb324aba0e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int8Array with respect to buf and byteOffset.
@param { ArrayBuffer } buf - data initializer
@param { int } byteOffset - byte offset from begin of the buf
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(buf: ArrayBuffer, byteOffset: int) {
this(buf, new Number(byteOffset), undefined)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array... | public constructor(buf: ArrayBuffer, byteOffset: int) {
this(buf, new Number(byteOffset), undefined)
} | https://gitcode.com/iop123123/arkts-static-skills | d4214e10d14b58af8d98a720dff4d1b54cfe60ac | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/Highlight.ets | arkts | getDataSetIndex | returns the index of the DataSet the highlighted value is in
@return | public getDataSetIndex(): number {
return this.mDataSetIndex;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSetIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST... | public getDataSetIndex(): number {
return this.mDataSetIndex;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | cf429b813fba0451f82707720091e57ced088c03 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/CryptoUtils.ets | arkts | encryptText | 加密密码
@param alias 密钥别名
@param password 字符串
@returns 结果Base64编码 | public static async encryptText(plainText: string): Promise<string> {
if (!plainText) {
return Promise.resolve('');
}
await CryptoUtils.generateKey();
const iv = ByteUtils.randomData(CryptoUtils.IV_LENGTH);
let encryptResult: string = '';
let handle: number = -1;
let options: huks.Hu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left encryptText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left plainText AST#identif... | public static async encryptText(plainText: string): Promise<string> {
if (!plainText) {
return Promise.resolve('');
}
await CryptoUtils.generateKey();
const iv = ByteUtils.randomData(CryptoUtils.IV_LENGTH);
let encryptResult: string = '';
let handle: number = -1;
let options: huks.Hu... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CryptoUtils.ets#L117-L144 | e52f162ed7253d2c8bec48d98479197c083261a4 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | cancel | 取消图片预加载
@param request 图片请求request | cancel(request: ImageKnifeRequest): void {
nativeNode.cancel(request);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageKnifeRequest AST#identifier#Right AST#)#L... | cancel(request: ImageKnifeRequest): void {
nativeNode.cancel(request);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L137-L139 | 302c7a2f1384673a4e68324a22605ed687864129 | gitcode |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/utils/PlaygroundRuntimeLogger.ets | arkts | createNewLogFile | Create a new log file for this session | private createNewLogFile(): void {
if (!this.logDirectory) {
return;
}
const date = new Date();
const fileName = `${this.getFullTimestamp(date)}.log`;
this.currentLogFile = `${this.logDirectory}/${fileName}`;
hilog.info(PlaygroundRuntimeLogger.DOMAIN, PlaygroundRuntimeLogger.TA... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createNewLogFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST... | private createNewLogFile(): void {
if (!this.logDirectory) {
return;
}
const date = new Date();
const fileName = `${this.getFullTimestamp(date)}.log`;
this.currentLogFile = `${this.logDirectory}/${fileName}`;
hilog.info(PlaygroundRuntimeLogger.DOMAIN, PlaygroundRuntimeLogger.TA... | https://github.com/AGenUI/AGenUI | 51bf668ac69fe7852bada9ee55b1c0a796988955 | github |
veaba/EsptouchForHarmony | entry/src/main/ets/esptouch/provision/APProvisioner.ets | arkts | provisionViaAP | Main entry: provision ESP32 via AP mode.
@param targetSsid - the WiFi SSID to send to ESP32
@param targetPassword - the WiFi password to send to ESP32
@param targetAuth - auth type (WPA, WPA2, WEP, nopass) | async provisionViaAP(
targetSsid: string,
targetPassword: string,
targetAuth: string
): Promise<APProvisionResult> {
let result: APProvisionResult = new APProvisionResult();
this.cancelled = false;
try {
// --- Step 1: Wait for user to connect to ESP32 AP ---
this.setPhase(APPro... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left provisionViaAP AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left targetSsid AST#identifier#Right AST#type_annotation#Lef... | async provisionViaAP(
targetSsid: string,
targetPassword: string,
targetAuth: string
): Promise<APProvisionResult> {
let result: APProvisionResult = new APProvisionResult();
this.cancelled = false;
try {
// --- Step 1: Wait for user to connect to ESP32 AP ---
this.setPhase(APPro... | https://github.com/veaba/EsptouchForHarmony | 8ee9634babda472df93b2d419e782c40b983b1ad | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/ScraperManager.ets | arkts | searchMultipleSources | ==================== 多源搜索方法 ====================
多源并行搜索
@param keyword 搜索关键词
@param contentType 内容类型
@param sources 指定源列表(可选,默认使用所有启用的源) | public async searchMultipleSources(
keyword: string,
contentType?: ScraperContentType,
sources?: ScraperSource[]
): Promise<MultiSourceSearchResult> {
const targetSources = sources || Array.from(this.enabledSources);
logger.info(TAG, `多源搜索: keyword=${keyword}, sources=${targetSources.join(',')}`... | 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 searchMultipleSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:... | public async searchMultipleSources(
keyword: string,
contentType?: ScraperContentType,
sources?: ScraperSource[]
): Promise<MultiSourceSearchResult> {
const targetSources = sources || Array.from(this.enabledSources);
logger.info(TAG, `多源搜索: keyword=${keyword}, sources=${targetSources.join(',')}`... | https://github.com/DaLongZhuaZi/manxia | c363e9f41bbea5bd6d1513d37aeb3b5ad8bf095b | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | isBackgroundMusic | 判断是否为背景音乐 | private isBackgroundMusic(type: SoundType): boolean {
return type === SoundType.BGM_MAIN || type === SoundType.BGM_GAME;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isBackgroundMusic 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#... | private isBackgroundMusic(type: SoundType): boolean {
return type === SoundType.BGM_MAIN || type === SoundType.BGM_GAME;
} | https://github.com/the-wwyang/kids-learning-app | 594d03ffcd8ed83463564f3919dac84acd853e5f | github |
Joker-x-dev/CoolMallArkTS | core/model/src/main/ets/network/NetworkResponse.ets | arkts | isSucceeded | 是否成功
@returns {boolean} 是否请求成功 | get isSucceeded(): boolean {
// 状态码为1000表示成功
return this.code === 1000;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isSucceeded 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#Ri... | get isSucceeded(): boolean {
// 状态码为1000表示成功
return this.code === 1000;
} | https://github.com/Joker-x-dev/CoolMallArkTS | ad5bbd62119a2526c84c0fcacc6bd60cab69a0db | github |
JQHxx/codelabs | SelectContact/entry/src/main/ets/common/utils/JsBridge.ets | arkts | initJsBridge | initialize the bridge. | initJsBridge(): void {
this.controller.runJavaScript(code);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initJsBridge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | initJsBridge(): void {
this.controller.runJavaScript(code);
} | https://github.com/JQHxx/codelabs | 8cdf47839cb6094d958339a34f22009ab22ba127 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | get | Gets the byte value wrapped in this ByteBox.
@returns { byte } The byte value wrapped in this ByteBox
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get(): byte {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | public get(): byte {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | 2c76ea1bc2bd489c1c6a2fbbb728a118a56d3849 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | doWrite | Implemented by subclass inheritance. The implementation logic of flushing chunks in the buffer must not be
directly called. The call is controlled by Writable.write.
@param { string | Uint8Array } [chunk] - Data to be written.
@param { string } [encoding] - Encoding type.
@param { Function } [callback] - Callback after... | doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void {
if (this.doWriteFunc !== null) {
this.doWriteFunc?.(chunk, encoding, callback);
return;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doWrite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left string AST#identifie... | doWrite(chunk: string | Uint8Array, encoding: string, callback: Function): void {
if (this.doWriteFunc !== null) {
this.doWriteFunc?.(chunk, encoding, callback);
return;
}
} | https://gitcode.com/iop123123/arkts-static-skills | 0f887cf78088e8662c41b7c25994564c2fe8f0c7 | gitcode |
zhangmeng1847/Preference | entry/src/main/ets/utils/MyPreferenceUtil.ets | arkts | putPreferenceValue | 增加(或修改)指定名称的preferences对象中存储的指定的key的数据为对应的value | async putPreferenceValue(name: string, key: string, value: preferences.ValueType){
if (!this.preferenceMap.has(name)) {
console.log('preferencesUtilTag', `Preferences[${name}]尚未初始化!`)
return
}
try {
let preference = this.preferenceMap.get(name)
// 写入数据
await preference.put(ke... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left putPreferenceValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right ... | async putPreferenceValue(name: string, key: string, value: preferences.ValueType){
if (!this.preferenceMap.has(name)) {
console.log('preferencesUtilTag', `Preferences[${name}]尚未初始化!`)
return
}
try {
let preference = this.preferenceMap.get(name)
// 写入数据
await preference.put(ke... | https://github.com/zhangmeng1847/Preference | f348d800cb1d6b8605b3e2c084e2164fafa1bc13 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlayStateApi.ets | arkts | reportPlaybackStart | reportPlaybackStart
@summary Reports playback has started within a session.
@param {PlayStateApiReportPlaybackStartRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof PlayStateApi | public async reportPlaybackStart(requestParameters: PlayStateApiReportPlaybackStartRequest = {}): Promise<void> {
return this.apiClient.post({path: "/Sessions/Playing", data: requestParameters.playbackStartInfo})
} | 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 reportPlaybackStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Rig... | public async reportPlaybackStart(requestParameters: PlayStateApiReportPlaybackStartRequest = {}): Promise<void> {
return this.apiClient.post({path: "/Sessions/Playing", data: requestParameters.playbackStartInfo})
} | https://github.com/OHPG/FinSdk | 6752b03876f943e9bebe5a2936596446c1952154 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | createArray | Creates a new JSON element containing an array of JSON elements.
@param {Array<JsonElement>} elements - The array of JSON elements to store
@returns {JsonElement} A new JsonElement containing the array | static createArray(elements: Array<JsonElement>): JsonElement {
const element = new JsonElement()
element.maybeArrayValues = Array.from<JsonElement>(elements)
return element
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left elements AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | static createArray(elements: Array<JsonElement>): JsonElement {
const element = new JsonElement()
element.maybeArrayValues = Array.from<JsonElement>(elements)
return element
} | https://gitcode.com/iop123123/arkts-static-skills | ab9fdac33759ffd4c0a4845c4ced258cde676d43 | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/AlbumService.ets | arkts | getKGAlbumDetail | 获取酷狗音乐专辑详情(包含歌曲列表)
@param albumId 专辑ID
@param page 页码,默认1
@param limit 每页数量,默认200
@returns Promise<AlbumDetail> | private static async getKGAlbumDetail(
albumId: string,
page: number,
limit: number
): Promise<AlbumDetail> {
const url = `http://mobiles.kugou.com/api/v3/album/song?version=9108&albumid=${albumId}&plat=0&pagesize=${limit}&area_code=0&page=${page}&with_res_tag=0`;
const defaultOptions: HttpRequ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getKGAlbumDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left albumId AST#i... | private static async getKGAlbumDetail(
albumId: string,
page: number,
limit: number
): Promise<AlbumDetail> {
const url = `http://mobiles.kugou.com/api/v3/album/song?version=9108&albumid=${albumId}&plat=0&pagesize=${limit}&area_code=0&page=${page}&with_res_tag=0`;
const defaultOptions: HttpRequ... | https://github.com/cpdd5201314/harmonyOS-music-app | 4bfe55758e1f29a08989f064221e4ed65c182576 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | has | Check whether the specified element is contained in the ArrayList.
@param element - the specified element.
@returns true if the specified element is included, otherwise, false. | public has(element: T): boolean {
return this.getIndexOf(element) != -1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public has(element: T): boolean {
return this.getIndexOf(element) != -1;
} | https://gitcode.com/iop123123/arkts-static-skills | 7bf25afa59fa4067c765a17e4aa9c5a4a932e7d8 | gitcode |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/AudioManager.ets | arkts | setVolume | 设置音量
@param volume 音量(0.0-1.0) | async setVolume(volume: number): Promise<void> {
try {
this.volume = Math.max(0, Math.min(1, volume));
if (this.audioPlayer) {
await this.audioPlayer.setVolume(this.volume);
}
} catch (error) {
console.error('设置音量失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setVolume AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left volume AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async setVolume(volume: number): Promise<void> {
try {
this.volume = Math.max(0, Math.min(1, volume));
if (this.audioPlayer) {
await this.audioPlayer.setVolume(this.volume);
}
} catch (error) {
console.error('设置音量失败:', error);
}
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 3ab90af048681f7cb49df533a03c259c7676626d | github |
Tianpei-Shi/MusicDash | src/services/UserService.ets | arkts | getUserById | 根据ID获取用户信息
@param userId 用户ID | async getUserById(userId: number): Promise<UserInfo | null> {
try {
const userData = await this.cloudDBService.getUserById(userId);
if (userData) {
return UserInfo.fromCloudObject(userData);
}
return null;
} catch (error) {
console.error('获取用户失败:', error);
return nu... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async getUserById(userId: number): Promise<UserInfo | null> {
try {
const userData = await this.cloudDBService.getUserById(userId);
if (userData) {
return UserInfo.fromCloudObject(userData);
}
return null;
} catch (error) {
console.error('获取用户失败:', error);
return nu... | https://github.com/Tianpei-Shi/MusicDash | 0314f787cf80eaac5695f0a71108c20e8a23b3a8 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | getFieldValueString | 获取字段值
@param fields 字段
@param key 字段key | public static getFieldValueString(fields: Map<string, KdbxEntryField>, key: string): string {
if (!fields || !fields.has(key)) {
return '';
}
return KdbxUtils.getValueString(fields.get(key));
} | 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 getFieldValueString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left fields AST#ident... | public static getFieldValueString(fields: Map<string, KdbxEntryField>, key: string): string {
if (!fields || !fields.has(key)) {
return '';
}
return KdbxUtils.getValueString(fields.get(key));
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L62-L67 | 5eb6b6a140febac8a9b0e8e6173256c46745c7a3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | getDownloadTask | 获取下载任务状态 | getDownloadTask(taskId: string): NovelDownloadTask | undefined {
return this.downloadTasks.get(taskId);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDownloadTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | getDownloadTask(taskId: string): NovelDownloadTask | undefined {
return this.downloadTasks.get(taskId);
} | https://github.com/DaLongZhuaZi/manxia | 0b7fdfe1a11986e156d2faa345c0eb66b3d9c687 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets | arkts | has | Checks if a value is in the HashSet
@param value the value to find in the HashSet
@returns true if the value is in the HashSet | has(value: T): boolean {
return this.buckets.hasKey(value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has 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 T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST... | has(value: T): boolean {
return this.buckets.hasKey(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 34c8129bf5b940542b65286661f52da6839a0491 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test24_original_index.ets | arkts | testChainedTernaryLookup | --- Chained ternary as lookup table --- | function testChainedTernaryLookup(): string {
let mode: number = 2;
let label: string = '';
if (mode === 0) {
label = 'read';
} else if (mode === 1) {
label = 'write';
} else if (mode === 2) {
label = 'execute';
} else {
label = 'unknown';
}
return label;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testChainedTernaryLookup 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#pr... | function testChainedTernaryLookup(): string {
let mode: number = 2;
let label: string = '';
if (mode === 0) {
label = 'read';
} else if (mode === 1) {
label = 'write';
} else if (mode === 2) {
label = 'execute';
} else {
label = 'unknown';
}
return label;
} | https://github.com/miaochiahao/ark-ghidra | bb8f7fb7a5611db18bc3c700a139cba7f1fb5b9a | github |
openharmony-sig/shimmer-ohos | library/src/main/ets/components/MainPage/Shimmer.ets | arkts | setAutoStart | Sets whether the shimmering animation will start automatically. | setAutoStart(status: boolean): Shimmer {
this.autoStart = status;
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAutoStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left )... | setAutoStart(status: boolean): Shimmer {
this.autoStart = status;
return this
} | https://gitee.com/openharmony-sig/shimmer-ohos.git | a579ac638cc0cc0df9622bbbdf9e30cb062c7836 | gitee |
erosTeam/NextE | shared/src/main/ets/network/EhHttpClient.ets | arkts | postLogin | POST the forums password-login form (single attempt). Sends a Referer + urlencoded body and returns
the FULL response header (rawHeader) so the caller can capture the Set-Cookie identity cookies — the
login succeeds iff that header carries ipb_member_id + ipb_pass_hash. | async postLogin(url: string, body: string, referer: string): Promise<EhTextResponse> {
const req: http.HttpRequest = http.createHttp()
try {
const header: Record<string, string> = {
'User-Agent': EhConstants.USER_AGENT,
'Accept': EhConstants.ACCEPT,
'Accept-Language': EhConstants... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left postLogin AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async postLogin(url: string, body: string, referer: string): Promise<EhTextResponse> {
const req: http.HttpRequest = http.createHttp()
try {
const header: Record<string, string> = {
'User-Agent': EhConstants.USER_AGENT,
'Accept': EhConstants.ACCEPT,
'Accept-Language': EhConstants... | https://github.com/erosTeam/NextE | 7f8b5d24b2b8e6d786adb4f76bcf7981c05de4fe | github |
seagazer/cclyric | lib/src/main/ets/CcLyricController.ets | arkts | setHighlightScale | Set the highlight scale of the text, default is 1.1f, must set before bind the CcLyricView.
@param scale The scale value. | public setHighlightScale(scale: number): CcLyricController {
this._highlightScale = scale
this.resize()
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setHighlightScale(scale: number): CcLyricController {
this._highlightScale = scale
this.resize()
return this
} | https://github.com/seagazer/cclyric | ee1c9e9225db70b1bf1cf9e1a71ffd137eca6e8a | github |
killetom/ktretrofit | entry/src/main/ets/example/RetrofitConfigExample.ets | arkts | createUserServiceConfig | Create the user service configuration with proper type annotations | private createUserServiceConfig(): ApiServiceConfig<UserService> {
// Define path parameter configuration
const pathIdParam: ApiParameterConfig = {
type: HttpParameterType.PATH,
name: 'id'
};
// Define query parameter configurations
const queryPageParam: ApiParameterConfig = {
t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createUserServiceConfig 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... | private createUserServiceConfig(): ApiServiceConfig<UserService> {
// Define path parameter configuration
const pathIdParam: ApiParameterConfig = {
type: HttpParameterType.PATH,
name: 'id'
};
// Define query parameter configurations
const queryPageParam: ApiParameterConfig = {
t... | https://github.com/killetom/ktretrofit | 98503b08196c5cd5f53af834a2235eb3ea96978f | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | isPromise | Check whether the entered value is of promise type.
@param { Object } value - A Promise value
@returns { boolean } Returns true if the value is a built-in Promise. | isPromise(value: Object): boolean {
return value instanceof Promise;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isPromise 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 Object AST#identifier#Right AST#)#Left ) AST#... | isPromise(value: Object): boolean {
return value instanceof Promise;
} | https://gitcode.com/iop123123/arkts-static-skills | e72a603c1d9e075fa2a4579e4349c34f3ec2611b | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/popup/OmniPopup.ets | arkts | setPopupPadding | 全局设置-弹窗内边距
@param popupPadding | static setPopupPadding(popupPadding: Padding | Length | LocalizedPadding) {
Config.popupConfig.popupPadding = popupPadding
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setPopupPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left popupPadding AST#identifier#Right AST#ERROR#Left... | static setPopupPadding(popupPadding: Padding | Length | LocalizedPadding) {
Config.popupConfig.popupPadding = popupPadding
} | https://github.com/wuba/omni-ui | 1d9dbfea60a93fe10a8bd895cf949606cc2f5902 | github |
LiHuaJZOAQ/GuardSysAPP | entry/src/main/ets/pages/WifiManager.ets | arkts | getWifiList | 获取WiFi扫描结果 | static async getWifiList(): Promise<WifiDeviceInfo[]> {
try {
const wifiList: Array<wifiManager.WifiScanInfo> = wifiManager.getScanInfoList();
const result: WifiDeviceInfo[] = [];
const ssidMap: Map<string, WifiDeviceInfo> = new Map<string, WifiDeviceInfo>();
// 获取当前连接的SSID
let curr... | 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 getWifiList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | static async getWifiList(): Promise<WifiDeviceInfo[]> {
try {
const wifiList: Array<wifiManager.WifiScanInfo> = wifiManager.getScanInfoList();
const result: WifiDeviceInfo[] = [];
const ssidMap: Map<string, WifiDeviceInfo> = new Map<string, WifiDeviceInfo>();
// 获取当前连接的SSID
let curr... | https://github.com/LiHuaJZOAQ/GuardSysAPP | 8766d1ac04ca19803f828eaef33692e7037f355f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | toLowerCase | toLowerCase() converts the underlying char to a lower case if it is in upper case, otherwise the char unchanged.
@returns { Char }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toLowerCase(): Char {
return Char.toLowerCase(this.value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLowerCase 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 Char AST#i... | public toLowerCase(): Char {
return Char.toLowerCase(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | e3e4bcfb515df33818096a40f71f76d059b89a3a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | removeListener | 移除任务状态监听器 | public removeListener(listener: TaskStatusListener): void {
this.listeners.delete(listener);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeListener 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#Le... | public removeListener(listener: TaskStatusListener): void {
this.listeners.delete(listener);
} | https://github.com/DaLongZhuaZi/manxia | 7cda734be65c749f6b03119b2dedc61a35108187 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | animationSpeed | 获取动画速度 | public get animationSpeed(): number {
return this.currentProfile.effects.animationSpeed;
} | 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 animationSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public get animationSpeed(): number {
return this.currentProfile.effects.animationSpeed;
} | https://github.com/DaLongZhuaZi/manxia | ff6f9751d3fcda116c31e56f0811c7463e747c25 | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/data/UserRdb.ets | arkts | updateNickname | ========== 核心修复:更新昵称前先初始化数据库 ========== | async updateNickname(nickname: string): Promise<number> {
if (nickname.trim() === '') {
throw new Error('昵称不能为空');
}
if (nickname.length > 12) {
throw new Error('昵称不能超过12个字符');
}
// 关键:如果未初始化且有上下文,先初始化数据库
if (!this.rdbStore && !this.isMock && this.context) {
await this.getRd... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateNickname AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nickname AST#identifier#Right ... | async updateNickname(nickname: string): Promise<number> {
if (nickname.trim() === '') {
throw new Error('昵称不能为空');
}
if (nickname.length > 12) {
throw new Error('昵称不能超过12个字符');
}
// 关键:如果未初始化且有上下文,先初始化数据库
if (!this.rdbStore && !this.isMock && this.context) {
await this.getRd... | https://gitcode.com/openharmony/codelabs | 83cfb5d5cedf423a52eea4be56e0b015ce0f578a | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets | arkts | values | Returns elements from the LightWeightMap as an values Iterator
@returns ValueIterator with hash map values | values(): IterableIterator<V> {
return new LightWeightMapIterator<K, V, V>(this, (index: int) => this.buckets.entryValues[index] as V);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left values 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#binary_expression#Left AST#identifier#Left IterableIterator AST#identif... | values(): IterableIterator<V> {
return new LightWeightMapIterator<K, V, V>(this, (index: int) => this.buckets.entryValues[index] as V);
} | https://gitcode.com/iop123123/arkts-static-skills | 6ff2bf1612b0eaea715063836c8c9b4cc57bfc5b | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | removeByName | 按路由名称删除指定的NavDestination
@param name 路由名称 | public removeByName(name: string) {
this.updateCurrentStackName()
this.routerMgr.removeByName(name)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeByName 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 str... | public removeByName(name: string) {
this.updateCurrentStackName()
this.routerMgr.removeByName(name)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L487-L490 | a0f8ad75279c676c54c5afffbf9e7909794a733f | github |
webabcd/HarmonyDemo | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | onRemoveForm | 卡片销毁时的回调 | onRemoveForm(formId: string) {
MyLog.d(`onRemoveForm: ${formId}`)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onRemoveForm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Righ... | onRemoveForm(formId: string) {
MyLog.d(`onRemoveForm: ${formId}`)
} | https://github.com/webabcd/HarmonyDemo | 44a3450afd2e7822b1e09bd5b8dd76cb576e45f1 | github |
arkui-x/samples | CodeLab/Cases/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets | arkts | updateData | 更新指定索引位置的元素
@param index 数组索引 | public updateData(index: number, data: ESObject): void {
this.originDataArray.splice(index, 1, data);
this.notifyDataChange(index);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public updateData(index: number, data: ESObject): void {
this.originDataArray.splice(index, 1, data);
this.notifyDataChange(index);
} | https://gitcode.com/arkui-x/samples | 07f4059b0d56f3b68bb167d0139660da1fdc21c0 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/AggregateResult.ets | arkts | count | 获取结果行数量
@returns 行数 | count(): number {
return this.rows.length
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left count 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_block#... | count(): number {
return this.rows.length
} | https://github.com/offlinecat-dev/OCNetORM | 896ade84106dde94424b85eb71f168e5e1b5ecf0 | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/SubWindowManager.ets | arkts | applyRoute | Apply a new route. Each branch is idempotent. | private applyRoute(next: CallRoute): void {
if (next === this._currentRoute && this._subWindow !== null) {
return;
}
Logger.info('SubWindowManager.applyRoute:', this._currentRoute, '->', next);
this._currentRoute = next;
if (next === CallRoute.none) {
void this.teardownSubWindow();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left next AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ca... | private applyRoute(next: CallRoute): void {
if (next === this._currentRoute && this._subWindow !== null) {
return;
}
Logger.info('SubWindowManager.applyRoute:', this._currentRoute, '->', next);
this._currentRoute = next;
if (next === CallRoute.none) {
void this.teardownSubWindow();
... | https://github.com/Tencent-RTC/TUIKit_Harmony | aff20b3d80cd81621dc846820dcb8fba483eb3ca | github |
arkui-x/samples | CodeLab/Cases/feature/eraser/src/main/ets/pages/EraserMainPage.ets | arkts | onTouchEvent | touch事件触发后绘制手指移动轨迹 | onTouchEvent(event: TouchEvent): void {
// 获取手指触摸位置的坐标点
const positionX: number = vp2px(event.touches[0].x);
const positionY: number = vp2px(event.touches[0].y);
switch (event.type) {
case TouchType.Down: {
// 初次绘制时创建一个新的MyRenderNode对象,用于记录和绘制手指移动的路径,后续绘制时在已创建的currentNodeDraw中重新添加路径
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTouchEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identifier#Right AST#)#Left... | onTouchEvent(event: TouchEvent): void {
// 获取手指触摸位置的坐标点
const positionX: number = vp2px(event.touches[0].x);
const positionY: number = vp2px(event.touches[0].y);
switch (event.type) {
case TouchType.Down: {
// 初次绘制时创建一个新的MyRenderNode对象,用于记录和绘制手指移动的路径,后续绘制时在已创建的currentNodeDraw中重新添加路径
... | https://gitcode.com/arkui-x/samples | 9fcd2184882d6b1b0b9c6522f6af62afaec0fa2d | gitcode |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue450.ets.audit.ets | arkts | initAll | HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 73 : issue450.ets | public initAll(windowLimits: BundleManager.WindowSize): void {
this.maxWindowWidth = windowLimits.maxWindowWidth;
this.minWindowWidth = windowLimits.minWindowWidth;
this.maxWindowHeight = windowLimits.maxWindowHeight;
this.minWindowHeight = windowLimits.minWindowHeight;
this.maxWindowRatio = windo... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left windowLimits AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressio... | public initAll(windowLimits: BundleManager.WindowSize): void {
this.maxWindowWidth = windowLimits.maxWindowWidth;
this.minWindowWidth = windowLimits.minWindowWidth;
this.maxWindowHeight = windowLimits.maxWindowHeight;
this.minWindowHeight = windowLimits.minWindowHeight;
this.maxWindowRatio = windo... | https://gitee.com/openharmony-sig/earth.git | 4c37c5caa6ce3f1f2d6fb8ec803a716a3f6f9d7d | gitee |
Vsolon0401/MallShopping | common/src/main/ets/utils/Preferences.ets | arkts | delete | 删除数据
@param key: 删除key的value值
@returns | async delete(key: string): Promise<void> {
return (await this.getPreferences()).delete(key).finally(async () => {
(await this.getPreferences()).flush()
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#formal_parameters#Left AST#(#L... | async delete(key: string): Promise<void> {
return (await this.getPreferences()).delete(key).finally(async () => {
(await this.getPreferences()).flush()
})
} | https://github.com/Vsolon0401/MallShopping | 7e4da0d1c30d235e2b56bfcde66cb98e89f58b3b | github |
2763981847/Accounting-app | entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | updateData | 更新账目数据 | updateData(account: Account, callback: Function) {
// 生成值桶,包含要更新的数据
const valueBucket: relationalStore.ValuesBucket = generateBucket(account);
// 创建 RdbPredicates 对象,指定更新条件为账目ID匹配
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.equalTo('id', ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Account AST#identifier#Righ... | updateData(account: Account, callback: Function) {
// 生成值桶,包含要更新的数据
const valueBucket: relationalStore.ValuesBucket = generateBucket(account);
// 创建 RdbPredicates 对象,指定更新条件为账目ID匹配
let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName);
predicates.equalTo('id', ... | https://github.com/2763981847/Accounting-app | 42a4f53355b67e2f169f33773de56405219d63e1 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/background/ReminderTaskDemo.ets | arkts | startAbility_notification_settings | 打开系统的通知设置页 | startAbility_notification_settings() {
let context = getContext(this) as common.UIAbilityContext;
let want: Want = {
/*
* uri - 需要跳转到的系统设置页面的名称
* systemui_notification_settings - 系统的通知设置页
* wifi_entry - 系统的 wifi 设置页
* 注:找到想要的系统设置页面的名称的方法如下
* 1、在 HiLog 中过滤 Settings... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAbility_notification_settings 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... | startAbility_notification_settings() {
let context = getContext(this) as common.UIAbilityContext;
let want: Want = {
/*
* uri - 需要跳转到的系统设置页面的名称
* systemui_notification_settings - 系统的通知设置页
* wifi_entry - 系统的 wifi 设置页
* 注:找到想要的系统设置页面的名称的方法如下
* 1、在 HiLog 中过滤 Settings... | https://github.com/webabcd/HarmonyDemo | 3f4cb46c4010c24073d87f9aea7a825db1eb4154 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/RequestQueue.ets | arkts | cleanupOrphanedTempRequests | At init we may have orphaned temp-ID requests from a previous session. If
we're not in temp mode anymore and no real ID can claim them, drop them.
Uses the same anchored regex as replaceTempDeviceId so a request whose
user-property VALUE merely contains the placeholder string isn't falsely
orphaned. | public async cleanupOrphanedTempRequests(): Promise<void> {
const encodedPlaceholder: string = encodeURIComponent(TEMP_DEVICE_ID);
const rx: RegExp = new RegExp(`(^|&)device_id=${escapeForRegex(encodedPlaceholder)}(?=&|$)`);
const before: number = this.queue.length;
this.queue = this.queue.filter((r: ... | 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 cleanupOrphanedTempRequests AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio... | public async cleanupOrphanedTempRequests(): Promise<void> {
const encodedPlaceholder: string = encodeURIComponent(TEMP_DEVICE_ID);
const rx: RegExp = new RegExp(`(^|&)device_id=${escapeForRegex(encodedPlaceholder)}(?=&|$)`);
const before: number = this.queue.length;
this.queue = this.queue.filter((r: ... | https://github.com/Countly/countly-sdk-hos | 4f16450a335da4e57b075968c9e1568ba2a5f54d | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/pages/views/LibraryView.ets | arkts | handleBatchShare | 批量分享逻辑 | handleBatchShare() {
if (this.selectedIds.length === 0) return;
const songsToShare = this.musicState.songList.filter(s => this.selectedIds.includes(s.id));
MusicShareService.shareSongs(songsToShare);
this.exitSelectMode();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleBatchShare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | handleBatchShare() {
if (this.selectedIds.length === 0) return;
const songsToShare = this.musicState.songList.filter(s => this.selectedIds.includes(s.id));
MusicShareService.shareSongs(songsToShare);
this.exitSelectMode();
} | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/pages/views/LibraryView.ets#L456-L462 | 1464410910dc53f0132d718990d2c79872f9e8ca | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/selection/SelectDemo.ets | arkts | MenuItemBuilder | 自定义 MenuItemContent | @Builder function MenuItemBuilder(configuration: MenuItemConfiguration) {
/*
* MenuItemConfiguration - 自定义 MenuItemContent 的相关信息
* value - 当前选项的文本
* icon - 当前选项的图标
* symbolIcon - 当前选项的图标
* selected - 当前选项是否被选中
* index - 当前选项的索引位置
* triggerChange() - 触发 Select 的 onSelect() 回调
*/
R... | 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 MenuItemBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#r... | @Builder function MenuItemBuilder(configuration: MenuItemConfiguration) {
/*
* MenuItemConfiguration - 自定义 MenuItemContent 的相关信息
* value - 当前选项的文本
* icon - 当前选项的图标
* symbolIcon - 当前选项的图标
* selected - 当前选项是否被选中
* index - 当前选项的索引位置
* triggerChange() - 触发 Select 的 onSelect() 回调
*/
R... | https://github.com/webabcd/HarmonyDemo | d9fa0519dc953bf1a7e9e7adc396184a8e9d08bb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets | arkts | setCurrentSource | 设置当前使用的 Suwayomi 扩展源 | public setCurrentSource(sourceId: string): void {
this.currentSourceId = sourceId;
logger.debug(TAG, `设置当前源: ${sourceId}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCurrentSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | public setCurrentSource(sourceId: string): void {
this.currentSourceId = sourceId;
logger.debug(TAG, `设置当前源: ${sourceId}`);
} | https://github.com/DaLongZhuaZi/manxia | 0320263620c7cc812879499dfcba69fadd7f26e2 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/DownloadDirManager.ets | arkts | getDownloadDirPath | 获取下载目录路径 | public getDownloadDirPath(): string {
return this.downloadDirPath;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDownloadDirPath 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 ... | public getDownloadDirPath(): string {
return this.downloadDirPath;
} | https://github.com/richshaw2015/nds | d92d05ba806efe561f30126903d7974979d76d81 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/StepCounterService.ets | arkts | removeStepChangeListener | 移除步数变化监听器 | public removeStepChangeListener(listener: (steps: number) => void): void {
const index = this.listeners.indexOf(listener);
if (index > -1) {
this.listeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeStepChangeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#L... | public removeStepChangeListener(listener: (steps: number) => void): void {
const index = this.listeners.indexOf(listener);
if (index > -1) {
this.listeners.splice(index, 1);
}
} | https://gitcode.com/openharmony/codelabs | 5f2431ef875383dd015e1eadcfe39346be3e8433 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | putValue | 设置任意类型值(批量导入用) | async putValue(key: string, value: preferences.ValueType): Promise<void> {
if (this.dataPreferences === null) {
return
}
try {
await this.dataPreferences.put(key, value)
await this.dataPreferences.flush()
} catch (error) {
console.error('PreferencesService', `Failed to put valu... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left putValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_an... | async putValue(key: string, value: preferences.ValueType): Promise<void> {
if (this.dataPreferences === null) {
return
}
try {
await this.dataPreferences.put(key, value)
await this.dataPreferences.flush()
} catch (error) {
console.error('PreferencesService', `Failed to put valu... | https://github.com/LongLiveY96/chatcube | cdfb8f454884f342253924f4d027257684bc44ae | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TaskExecutor.ets | arkts | registerWorkflow | 注册工作流 | registerWorkflow(name: string, actions: Action[]): void {
this.workflows.set(name, actions);
logger.debug(TAG, `注册工作流: ${name}, 操作数: ${actions.length}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerWorkflow 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 ... | registerWorkflow(name: string, actions: Action[]): void {
this.workflows.set(name, actions);
logger.debug(TAG, `注册工作流: ${name}, 操作数: ${actions.length}`);
} | https://github.com/DaLongZhuaZi/manxia | e1b5dc97edfd936bed32c59432c989ae324686a6 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.