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 |
|---|---|---|---|---|---|---|---|---|---|---|
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getHotTopics | Get hot topics from the public HTML hot tab to avoid legacy JSON API rate limits. | async getHotTopics(): Promise<V2exTopic[]> {
return this.getHotTabTopics()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getHotTopics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async getHotTopics(): Promise<V2exTopic[]> {
return this.getHotTabTopics()
} | https://github.com/honjow/Next2V | fce1f1e8b428a578b5af7af4cdcb5a042414982f | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | $_get | Gets the element at the specified index.
@param index - The index of the element to retrieve.
@returns The element at the specified index. | public $_get(index: int): T {
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
return this.buffer[index];
} | 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#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public $_get(index: int): T {
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
return this.buffer[index];
} | https://gitcode.com/iop123123/arkts-static-skills | 474d15c6aab0c1c9b090b43a056297828b9cacb2 | gitcode |
Joker-x-dev/CoolMallArkTS | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | executeRequest | 发起请求
@returns {void} 无返回值 | executeRequest(): void {
RequestHelper.repository<T>(this.requestRepository())
.toast(this.showErrorToast)
.start(() => this.onRequestStart())
.execute()
.then((data: T) => this.onRequestSuccess(data))
.catch(() => this.onRequestError());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left executeRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | executeRequest(): void {
RequestHelper.repository<T>(this.requestRepository())
.toast(this.showErrorToast)
.start(() => this.onRequestStart())
.execute()
.then((data: T) => this.onRequestSuccess(data))
.catch(() => this.onRequestError());
} | https://github.com/Joker-x-dev/CoolMallArkTS | f7b6a58c7b52aeaf67c09070964420d8d3aceb26 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | unicode | Gets the unicode flag, indicating whether to enable Unicode mode.
@return { boolean } `true` if Unicode mode is enabled, `false` otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get unicode(): boolean {
return this.isUnicode
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left unicode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right ... | get unicode(): boolean {
return this.isUnicode
} | https://gitcode.com/iop123123/arkts-static-skills | 36608d21a170c5449b1ced471af8c25de12e4c0d | gitcode |
arkui-x/samples | CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets | arkts | getStatusBarHeight | 获取主窗口顶部导航栏高度
@returns {callback((statusBarHeight: number) => void))} | getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to obtai... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatusBarHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Lef... | getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to obtai... | https://gitcode.com/arkui-x/samples | 4e329611618cbb6b16c6e9894b0ae1ba3cd8dc5c | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | initAVSession | 初始化 AVSession 支持后台播放和媒体控制中心 | private async initAVSession(): Promise<void> {
if (!this.context) {
console.warn('Context not set, AVSession will not be initialized');
return;
}
try {
// 创建 AVSession
this.session = await avSession.createAVSession(this.context, 'AntennaPod', 'audio');
// 设置播放命令回调
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initAVSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async initAVSession(): Promise<void> {
if (!this.context) {
console.warn('Context not set, AVSession will not be initialized');
return;
}
try {
// 创建 AVSession
this.session = await avSession.createAVSession(this.context, 'AntennaPod', 'audio');
// 设置播放命令回调
... | https://github.com/pangpang20/antennaPodHM | 158792e34ac6dbaee2c1534b6d6dbee0ad3ead1f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | validateChapterInfo | 验证章节信息 | private validateChapterInfo(chapterInfo: ComicChapterInfo): void {
if (!chapterInfo.chapterId) {
throw new Error('章节ID不能为空');
}
if (!chapterInfo.pages || chapterInfo.pages.length === 0) {
throw new Error('章节页面不能为空');
}
// 验证页面文件存在性
for (const page of chapterInfo.pages) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateChapterInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapterInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | private validateChapterInfo(chapterInfo: ComicChapterInfo): void {
if (!chapterInfo.chapterId) {
throw new Error('章节ID不能为空');
}
if (!chapterInfo.pages || chapterInfo.pages.length === 0) {
throw new Error('章节页面不能为空');
}
// 验证页面文件存在性
for (const page of chapterInfo.pages) {
... | https://github.com/DaLongZhuaZi/manxia | 0989fa29dc3249df60c2bad3f5432d90a3bba820 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/service/ReportService.ets | arkts | getReportList | 获取报表列表 | getReportList(): Promise<ReportInfo[]> {
return new Promise((resolve) => {
setTimeout(() => {
const mockData: ReportInfo[] = [
{ id: '1', name: '4月份财务汇总报告', type: '月度报告', period: '2024-04', status: 'completed', createTime: '2024-04-30 10:30', updateTime: '2024-04-30 10:35' },
{ i... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getReportList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | getReportList(): Promise<ReportInfo[]> {
return new Promise((resolve) => {
setTimeout(() => {
const mockData: ReportInfo[] = [
{ id: '1', name: '4月份财务汇总报告', type: '月度报告', period: '2024-04', status: 'completed', createTime: '2024-04-30 10:30', updateTime: '2024-04-30 10:35' },
{ i... | https://github.com/David8Idira/AI-OA | 2dfa7bd96941c67b204a679631c982861e54ec11 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | valueOf | Returns the object itself
@returns { Uint8Array }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public valueOf(): Uint8Array {
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf 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 Uint8Array AST... | public valueOf(): Uint8Array {
return this
} | https://gitcode.com/iop123123/arkts-static-skills | de966615a315ac8dae049754c985c1065c96eeda | gitcode |
openharmony/arkui_ace_engine | examples/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets | arkts | checkDataType | [End springLoading_builder]
检查拖拽数据类型是否包含所希望的plain-text | checkDataType(dataSummary: unifiedDataChannel.Summary | undefined): boolean {
let summary = dataSummary?.summary;
if (summary == undefined) {
return false;
}
let dataSummaryObjStr: string = JSON.stringify(summary);
let dataSummaryArray: Array<Array<string>> = JSON.parse(dataSummaryObjStr);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkDataType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSummary AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#member_expression#Left A... | checkDataType(dataSummary: unifiedDataChannel.Summary | undefined): boolean {
let summary = dataSummary?.summary;
if (summary == undefined) {
return false;
}
let dataSummaryObjStr: string = JSON.stringify(summary);
let dataSummaryArray: Array<Array<string>> = JSON.parse(dataSummaryObjStr);
... | https://gitcode.com/openharmony/arkui_ace_engine | d9579250ff2ddd60e0cabf0adcc9847de0ed2694 | gitcode |
openharmony/communication_bluetooth_service | test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/subBrTest/deviceFound.ets | arkts | getConnectionStateText | Get connection state text
@param connectionState | function getConnectionStateText(device: BluetoothDevice): Resource {
let stateText: Resource = $r('app.string.bluetooth_state_unknown');
switch ( device.connectionState ) {
case DeviceState.STATE_DISCONNECTED:
stateText = $r('app.string.bluetooth_state_disconnected');
break;
case DeviceState.ST... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getConnectionStateText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left device AST#identifier#Right AST#type_annotation#Left AST#:#Left... | function getConnectionStateText(device: BluetoothDevice): Resource {
let stateText: Resource = $r('app.string.bluetooth_state_unknown');
switch ( device.connectionState ) {
case DeviceState.STATE_DISCONNECTED:
stateText = $r('app.string.bluetooth_state_disconnected');
break;
case DeviceState.ST... | https://gitee.com/openharmony/communication_bluetooth_service.git | b7e4bdb867d28101d4da6a9f84aded8af521662b | gitee |
apap6628114/nga_oh | entry/src/main/ets/store/AuthStore.ets | arkts | setAuth | ============== Auth ============== | async setAuth(token: string, uid: string, nickName: string, avatarUrl: string): Promise<boolean> {
const uidChanged = this.state.uid !== uid
this.state.token = token
this.state.uid = uid
this.state.nickName = nickName
this.state.avatarUrl = avatarUrl
this.state.isAuthenticated = true
this.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setAuth AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left token AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async setAuth(token: string, uid: string, nickName: string, avatarUrl: string): Promise<boolean> {
const uidChanged = this.state.uid !== uid
this.state.token = token
this.state.uid = uid
this.state.nickName = nickName
this.state.avatarUrl = avatarUrl
this.state.isAuthenticated = true
this.... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AuthStore.ets#L56-L66 | e861a28d3a8094637fb18457758531fd5daacd28 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/DatabaseHelper.ets | arkts | getTransactionDao | 获取交易 Dao 实例 | public static getTransactionDao(): TransactionDao {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return DatabaseHelper.transactionDao;
} | 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 getTransactionDao AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public static getTransactionDao(): TransactionDao {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return DatabaseHelper.transactionDao;
} | https://github.com/fuhhhhhhhh/openharmony | 696bacbaacd130c6086498124632549334cc44c7 | github |
offlinecat-dev/OCNetORM | src/main/ets/schema/SchemaBuilder.ets | arkts | generateColumnDefinition | 生成单个列的定义 SQL 片段
@param column 列元数据
@returns 列定义 SQL 片段 | private generateColumnDefinition(column: ColumnMetadata): string {
const parts: Array<string> = []
// 列名(使用转义后的列名防止 SQL 注入)
parts.push(this.escapeIdentifier(column.columnName))
// 列类型
parts.push(column.columnType)
// 主键约束
if (column.isPrimaryKey) {
parts.push('PRIMARY KEY')
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateColumnDefinition 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#id... | private generateColumnDefinition(column: ColumnMetadata): string {
const parts: Array<string> = []
// 列名(使用转义后的列名防止 SQL 注入)
parts.push(this.escapeIdentifier(column.columnName))
// 列类型
parts.push(column.columnType)
// 主键约束
if (column.isPrimaryKey) {
parts.push('PRIMARY KEY')
}
... | https://github.com/offlinecat-dev/OCNetORM | 5b2f8d8b9359b263ea597aa81ae4c69a4864e666 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | loginFromLocal | 从本地获取登录信息并登录 | async loginFromLocal() {
try {
let result = await globalVM_WanDB.fetchLocalLoginInfo();
if (result !== null) {
// let id = result[0];
let login_info = result[1];
let user_info = result[2];
let cookie = result[3];
let password = result[4];
// let login_st... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginFromLocal AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{... | async loginFromLocal() {
try {
let result = await globalVM_WanDB.fetchLocalLoginInfo();
if (result !== null) {
// let id = result[0];
let login_info = result[1];
let user_info = result[2];
let cookie = result[3];
let password = result[4];
// let login_st... | https://github.com/RedRackham-R/WanAndroidHarmoney | 324740ec7b1b8646aa3c3f74ad3c7b7253b9d01f | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | stop | Halt the instance WITHOUT wiping persisted storage. Drains module state
to the request queue, halts the queue, deregisters the lifecycle
observer, cancels background timers. The persisted request queue,
device ID, server-config cache, health-check counters, user-profile
cache, and remote-config cache all survive on dis... | public async stop(): Promise<void> {
// Flip the global module gate FIRST so any user-facing module mutator
// invoked from THIS point onward (including during halt drains, if an
// integrator races a recordEvent against haltAll) is rejected at its
// module's entry point. Internal halt-drain paths ca... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | public async stop(): Promise<void> {
// Flip the global module gate FIRST so any user-facing module mutator
// invoked from THIS point onward (including during halt drains, if an
// integrator races a recordEvent against haltAll) is rejected at its
// module's entry point. Internal halt-drain paths ca... | https://github.com/Countly/countly-sdk-hos | d2cac12db8e69006eac32a2a1a49dbf199204b8d | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets | arkts | getSearchKeywordList | 查询搜索关键词列表
@returns 搜索关键词列表响应 | async getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>> {
const resp: AxiosResponse<NetworkResponse<GoodsSearchKeyword[]>> =
await NetworkClient.http.post("goods/search/keyword/list");
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSearchKeywordList 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 getSearchKeywordList(): Promise<NetworkResponse<GoodsSearchKeyword[]>> {
const resp: AxiosResponse<NetworkResponse<GoodsSearchKeyword[]>> =
await NetworkClient.http.post("goods/search/keyword/list");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 52b1e0d917bc0c8f056866a28debc5328b3ad3d4 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/Luban.ets | arkts | setOnRename | 设置重命名回调函数
@param callback 重命名回调函数
@returns 构建器实例 | setOnRename(callback: RenameCallback): LubanBuilder {
this.config.onRename = callback;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOnRename AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RenameCallback AST#identifier#Right AST#... | setOnRename(callback: RenameCallback): LubanBuilder {
this.config.onRename = callback;
return this;
} | https://github.com/kumaleap/ArkLuban | f9b94d29cc9113c19e0817f40d7be417b996047e | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridWebView.ets | arkts | handleRenderComplete | Reports the rendered Web height to C++.
@param scrollHeight document.body.scrollHeight in vp | public handleRenderComplete(scrollHeight: number): void {
const property = this.getProperty() as HybridWebProperty;
// Read configured height constraints.
const configuredHeight = property.height; // Explicit height property
const yogaHeight = property.getViewHeight(); // Height reported back by Yo... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleRenderComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scrollHeight AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | public handleRenderComplete(scrollHeight: number): void {
const property = this.getProperty() as HybridWebProperty;
// Read configured height constraints.
const configuredHeight = property.height; // Explicit height property
const yogaHeight = property.getViewHeight(); // Height reported back by Yo... | https://github.com/AGenUI/AGenUI | 3e5ed1209fd97bc8361c8ff99d1c002b882a020c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | split | Splits this String by pattern and returns ordered array of substrings.
The order of the resulted array corresponds to the order of the
passage of this String from beginning to end. The pattern is
excluded from substrings. The array is limited by some specified value.
@param pattern String to split by
@param limit max l... | public split(pattern: String, limit: number): String[] {
return this.split(pattern, limit as int)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left split AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left patter... | public split(pattern: String, limit: number): String[] {
return this.split(pattern, limit as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cb7b3821286150b11053c43aad01d9829dcd47a4 | gitee |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | createPadding | Return a String of padding of length {@code len}.
@param len The length of the String of padding to create.
@return The String of padding | protected createPadding(len: number): string {
let padding = "";
for (let index = 0;index < len; index++) {
padding += " ";
}
return padding;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left createPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left len AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | protected createPadding(len: number): string {
let padding = "";
for (let index = 0;index < len; index++) {
padding += " ";
}
return padding;
} | https://gitee.com/openharmony-sig/commons-cli.git | 6fecf69ed92546a93ae5f6f3df01eefcb7e17a4f | gitee |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/components/bottomNav.ets | arkts | aboutToAppear | 最多可选1张图片 | aboutToAppear(): void {
AppStorage.setOrCreate(Constants.SHOW_DIALOG, this.showDialog)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
AppStorage.setOrCreate(Constants.SHOW_DIALOG, this.showDialog)
} | https://github.com/SMAT-Lab/PhantomRendering | 9177628a3c743ca59a68d44db964b5d067f87860 | github |
HunZiLei/ArkTS_PokePomodoro | entry/src/main/ets/components/IndexTabPages/DDLState.ets | arkts | aboutToAppear | 数据库操作封装 结束
组件生命周期 | aboutToAppear() {
Logger.debug(`[DDLState] aboutToAppear`)
if (this.firstOpen) {
this.taskTable.getRdbStore(() => {
this.taskTable.query('', (result: TaskData[]) => {
this.tasks = result
for (let i = 0; i < this.tasks.length; ++i) {
this.tasks[i].setDDLState()
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
Logger.debug(`[DDLState] aboutToAppear`)
if (this.firstOpen) {
this.taskTable.getRdbStore(() => {
this.taskTable.query('', (result: TaskData[]) => {
this.tasks = result
for (let i = 0; i < this.tasks.length; ++i) {
this.tasks[i].setDDLState()
... | https://github.com/HunZiLei/ArkTS_PokePomodoro | 612bb5bf858f9a0d7969506f7b6c9fdad0b3c368 | github |
openharmony/applications_mms | entry/src/main/ets/utils/TelephoneUtil.ets | arkts | bubbleSort | Bubble sort, sorted in ascending order.
@param arr
@param length
@return | bubbleSort(arr, length) {
// A minimum value is generated from the back to the front at a time, and the final position of a number
// in the sequence can be determined at a time.
for (let i = 0; i < length - 1; i++) {
// Improvement of bubbling so that the sequence is ordered if ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left bubbleSort AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arr AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left length AST#identifier#Right AST#)#Left ) AST#)#Right AST#argum... | bubbleSort(arr, length) {
// A minimum value is generated from the back to the front at a time, and the final position of a number
// in the sequence can be determined at a time.
for (let i = 0; i < length - 1; i++) {
// Improvement of bubbling so that the sequence is ordered if ... | https://gitee.com/openharmony/applications_mms.git | 0806247dd98d12d8d417dc7a17924dd2501e7c88 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | updateStatus | 更新邀请状态 | static async updateStatus(invitationId: number, status: string): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
status: status,
responded_at: now,
updated_at: now
... | 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 updateStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left invitationId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | static async updateStatus(invitationId: number, status: string): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
status: status,
responded_at: now,
updated_at: now
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3ae9b7e0cd6b23f22c7c91edbeb554506e08d899 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/by_av_player.ets | arkts | audio_seek | 调节时间 // | audio_seek(time: number) {
this.avPlayer?.seek(time)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left audio_seek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS... | audio_seek(time: number) {
this.avPlayer?.seek(time)
} | https://github.com/Nekofox-POT/LinMusic | 71556dc0633e64dd2eec133b45adf62971d60068 | github |
Joker-x-dev/HarmonyKit | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | getDisplayPhone | 获取展示手机号
@returns {ResourceStr} 展示手机号 | getDisplayPhone(): ResourceStr {
const phone: string = this.userState.getUserInfo().phone?.trim() ?? "";
return phone.length > 0 ? phone : $r("app.string.user_profile_phone_empty");
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayPhone 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 ResourceStr AST#identifier#Right AST#ERROR#Rig... | getDisplayPhone(): ResourceStr {
const phone: string = this.userState.getUserInfo().phone?.trim() ?? "";
return phone.length > 0 ? phone : $r("app.string.user_profile_phone_empty");
} | https://github.com/Joker-x-dev/HarmonyKit | 37d63af76ee83183385827a0130fde50b8fac89f | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | querySubscribedPodcasts | 查询所有订阅的播客 | async querySubscribedPodcasts(): Promise<Podcast[]> {
if (!this.rdbStore) return [];
try {
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_PODCAST);
predicates.equalTo('isSubscribed', 1);
predicates.orderByDesc('subscribeDate');
const resultSet = await this.rdbSt... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left querySubscribedPodcasts 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 querySubscribedPodcasts(): Promise<Podcast[]> {
if (!this.rdbStore) return [];
try {
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_PODCAST);
predicates.equalTo('isSubscribed', 1);
predicates.orderByDesc('subscribeDate');
const resultSet = await this.rdbSt... | https://github.com/pangpang20/antennaPodHM | f5485c4647759c6e4ca7bfaf2e3b29738ee3f6d0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ImagePreprocessor.ets | arkts | process | 处理图像
@param imageUri 图像URI
@param params 预处理参数
@returns 处理后的图像数据 | async process(imageUri: string, params?: PreprocessingParams): Promise<ImageData> {
console.info('[ImagePreprocessor] 开始预处理图像:', imageUri);
// 模拟处理:创建一个简单的图像数据
const width = params?.targetWidth || 1200;
const height = params?.targetHeight || 1600;
const data = new Uint8ClampedArray(width * height... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left process AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageUri AST#identifier#Right AST#type_annotation#Left AST#:#L... | async process(imageUri: string, params?: PreprocessingParams): Promise<ImageData> {
console.info('[ImagePreprocessor] 开始预处理图像:', imageUri);
// 模拟处理:创建一个简单的图像数据
const width = params?.targetWidth || 1200;
const height = params?.targetHeight || 1600;
const data = new Uint8ClampedArray(width * height... | https://github.com/LJ666-ui/harmony-health-care | 310222e1aece025f32685fd89dd7aa65eda8ff56 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyManager.ets | arkts | exportProfile | ── 导入/导出 ──
导出当前配置到 JSON 文件
打开系统文件保存选择器 | async exportProfile(): Promise<void> {
try {
const json = await CustomKeyStore.exportProfile();
const profileName = await CustomKeyStore.getActiveProfileName();
const documentPicker = new picker.DocumentViewPicker();
const saveOptions = new picker.DocumentSaveOptions();
saveOptions.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exportProfile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi... | async exportProfile(): Promise<void> {
try {
const json = await CustomKeyStore.exportProfile();
const profileName = await CustomKeyStore.getActiveProfileName();
const documentPicker = new picker.DocumentViewPicker();
const saveOptions = new picker.DocumentSaveOptions();
saveOptions.... | https://github.com/AlkaidLab/moonlight-harmony | b1778cc03b37fe94b9b716393c8c5d240b0bd07c | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/common/BioAuthConfig.ets | arkts | detectFacePosition | 人脸位置检测(模拟) | static detectFacePosition(
x: number,
y: number,
size: number,
centerX: number = 150,
centerY: number = 150,
baseSize: number = 100
): FacePositionResult {
const offsetX = x - centerX;
const offsetY = y - centerY;
const offsetSize = size - baseSize;
const tolerance = BioAuthC... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectFacePosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static detectFacePosition(
x: number,
y: number,
size: number,
centerX: number = 150,
centerY: number = 150,
baseSize: number = 100
): FacePositionResult {
const offsetX = x - centerX;
const offsetY = y - centerY;
const offsetSize = size - baseSize;
const tolerance = BioAuthC... | https://gitcode.com/openharmony/codelabs | c13c86bcbb97d365e2882b20ae60e14b6dca2e14 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | setDateShow | Check whether the time on the top of each SMS message is displayed. | setDateShow(item, list) {
if (item == undefined || list == undefined) {
returen;
}
item.dateShow = true;
if (item.date == undefined || item.date == null) {
return;
}
if (item.date.id == undefined || item.date.id == null) {
return;
}
let tempDateId = item.date?.id;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setDateShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left list AST#identifier#Right AST#)#Left ) AST#)#Right AST#argum... | setDateShow(item, list) {
if (item == undefined || list == undefined) {
returen;
}
item.dateShow = true;
if (item.date == undefined || item.date == null) {
return;
}
if (item.date.id == undefined || item.date.id == null) {
return;
}
let tempDateId = item.date?.id;
... | https://gitee.com/openharmony/applications_mms.git | 8d3ffc07cccf0b2ae073eb1a002230811ef74690 | gitee |
openharmony/codelabs | ETSUI/CoinNote/entry/src/main/ets/db/BillRdb.ets | arkts | clearAll | 清空所有数据 | clearAll(): Promise<void> {
if (this.isMock) {
this.mockData = [];
return Promise.resolve();
}
if (!this.rdbStore) return Promise.reject(new Error('Store not initialized'));
let predicates = new relationalStore.RdbPredicates(this.tableName);
return this.rdbStore.delete(predicates).th... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident... | clearAll(): Promise<void> {
if (this.isMock) {
this.mockData = [];
return Promise.resolve();
}
if (!this.rdbStore) return Promise.reject(new Error('Store not initialized'));
let predicates = new relationalStore.RdbPredicates(this.tableName);
return this.rdbStore.delete(predicates).th... | https://gitcode.com/openharmony/codelabs | 63efaf2c1630d75cb4eaa74d4c7abf1ff42d73da | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/checkbox/index.ets | arkts | handleMaxChange | 当选中的最大数量变化时 或者选中的数据变化时 | handleMaxChange(data: IBestCheckboxMaxChangeParams) {
if (data.max <= 0) {
this.checkboxGroupMaxDisabled = false
return
}
const length = data.checkedList.length
const index = data.checkedList.findIndex(item => item === this.name)
if (index > -1) {
return
}
this.checkboxGroupMaxDisabled = length ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleMaxChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IBestCheckboxMaxChangePar... | handleMaxChange(data: IBestCheckboxMaxChangeParams) {
if (data.max <= 0) {
this.checkboxGroupMaxDisabled = false
return
}
const length = data.checkedList.length
const index = data.checkedList.findIndex(item => item === this.name)
if (index > -1) {
return
}
this.checkboxGroupMaxDisabled = length ... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkbox/index.ets#L226-L237 | 4e5dfede4e4cf9cb2e3e9f3fd7b74921721e0292 | github |
openharmony/applications_mms | entry/src/main/ets/utils/DeviceUtil.ets | arkts | isTablet | Querying the Device Type
default:Smartphones
tablet:flat plate
tv:Smart screen
wearable:Smart Wear
liteWearable:Lightweight intelligent wearable
smartVision:Smart Vision Devices | static isTablet(): boolean{
let curBp = AppStorage.get('curBp');
return curBp === 'tablet';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isTablet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool... | static isTablet(): boolean{
let curBp = AppStorage.get('curBp');
return curBp === 'tablet';
} | https://gitee.com/openharmony/applications_mms.git | dcb942ef49ac90fec39bcaa9c16440137ca74f34 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | loadLocalChapters | 加载本地章节 | private async loadLocalChapters(mangaId: string): Promise<MangaChapter[]> {
const localChapters = await this.dataManager.getComicChapters(mangaId);
return localChapters.map((ch: ChapterInfo, index: number): MangaChapter => ({
id: ch.id,
title: ch.title,
chapterNumber: ch.index || index,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadLocalChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#... | private async loadLocalChapters(mangaId: string): Promise<MangaChapter[]> {
const localChapters = await this.dataManager.getComicChapters(mangaId);
return localChapters.map((ch: ChapterInfo, index: number): MangaChapter => ({
id: ch.id,
title: ch.title,
chapterNumber: ch.index || index,
... | https://github.com/DaLongZhuaZi/manxia | 464b198ff97232edc8af0ed1fe30f9ea2bea4eb7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets | arkts | replaceUrlParams | 替换URL中的参数 | replaceUrlParams(url: string, params: Record<string, string>): string {
let result = url;
Object.keys(params).forEach(key => {
// 替换路径参数 :param
result = result.replace(`:${key}`, params[key]);
// 替换模板参数 {param}
result = result.replace(`{${key}}`, params[key]);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replaceUrlParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,... | replaceUrlParams(url: string, params: Record<string, string>): string {
let result = url;
Object.keys(params).forEach(key => {
// 替换路径参数 :param
result = result.replace(`:${key}`, params[key]);
// 替换模板参数 {param}
result = result.replace(`{${key}}`, params[key]);
... | https://github.com/DaLongZhuaZi/manxia | 5e8df9cee20280489affb1cdefc1df7ed6a68e9f | github |
honjow/Next2V | shared/src/main/ets/backup/BackupAccountAdapter.ets | arkts | restoreSection | Replace the local account list with the backup's accounts and re-apply the active
account's cookie/session into the runtime. Existing local accounts are cleared first so
the restore is deterministic and matches the rest of the import (overwrite semantics). | static async restoreSection(
context: common.UIAbilityContext,
section: BackupUserInfoSection,
): Promise<void> {
await BackupAccountAdapter.restoreNetworkProxy(context, section)
const accounts = section.accounts || []
await AccountStore.replaceAllFromBackup(context, BackupAccountAdapter.toRecor... | 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 restoreSection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :... | static async restoreSection(
context: common.UIAbilityContext,
section: BackupUserInfoSection,
): Promise<void> {
await BackupAccountAdapter.restoreNetworkProxy(context, section)
const accounts = section.accounts || []
await AccountStore.replaceAllFromBackup(context, BackupAccountAdapter.toRecor... | https://github.com/honjow/Next2V | 153e8ffa3eb8e64e3958887a383a62d86ab53eee | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | resolveDiscoveryValidationUrl | 解析用于发现校验的首个可用URL | private async resolveDiscoveryValidationUrl(source: LegadoBookSource, executor: NovelSourceExecutor): Promise<string | null> {
if (!source.exploreUrl) {
return null;
}
const trimmedExploreUrl = source.exploreUrl.trim();
const exploreKinds = await executor.getExploreKindsAsync();
for (let i ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left resolveDiscoveryValidationUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#R... | private async resolveDiscoveryValidationUrl(source: LegadoBookSource, executor: NovelSourceExecutor): Promise<string | null> {
if (!source.exploreUrl) {
return null;
}
const trimmedExploreUrl = source.exploreUrl.trim();
const exploreKinds = await executor.getExploreKindsAsync();
for (let i ... | https://github.com/DaLongZhuaZi/manxia | 6bc90e48a4e8b6ebb1aaa93edf4ed0f71b92be71 | github |
JQHxx/codelabs | NewsRelease/entry/src/main/ets/viewmodel/NewsTypeViewModel.ets | arkts | getDefaultTypeList | Get default news type list.
@return NewsTypeModel[] newsTypeList | getDefaultTypeList(): NewsTypeModel[] {
return DEFAULT_NEWS_TYPES;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDefaultTypeList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NewsTypeModel... | getDefaultTypeList(): NewsTypeModel[] {
return DEFAULT_NEWS_TYPES;
} | https://github.com/JQHxx/codelabs | 9cdbd78e7b3cbcee76dce37865985f13d1ef78e5 | github |
YDYm233/EasyRandom_HarmonyNextApp | product/default/src/main/ets/pages/SettingPage/SettingPage.ets | arkts | getInitialPage | 获取初始页面名称
@param params 页面参数
@param breakpoint 当前断点值
@returns 页面名称,空字符串表示不预加载子页面 | static getInitialPage(params: SettingParams, breakpoint: string): string {
// 策略1:隐私政策
if (params.type === SettingPageType.PRIVATE_POLICY) {
return '隐私政策'
}
// 策略2:公告页面
if (params.type === SettingPageType.ANNOUNCEMENT) {
return '公告与功能'
}
// 策略3:开发者团队
if (params.ty... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInitialPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static getInitialPage(params: SettingParams, breakpoint: string): string {
// 策略1:隐私政策
if (params.type === SettingPageType.PRIVATE_POLICY) {
return '隐私政策'
}
// 策略2:公告页面
if (params.type === SettingPageType.ANNOUNCEMENT) {
return '公告与功能'
}
// 策略3:开发者团队
if (params.ty... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 3974e5f4b4a9d3cfcefbf1726f8ca37b90115692 | github |
Zhiyilang074811/enterprise-ai-assistant | harmony_app/entry/src/main/ets/services/ApiService.ets | arkts | post | 发送HTTP POST请求 | private async post<T>(url: string, data: Record<string, any>): Promise<T> {
const httpRequest = http.createHttp();
try {
const response = await httpRequest.request(url, {
method: http.RequestMethod.POST,
header: {
'Content-Type': 'application/json',
'Accept': 'ap... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left post AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#... | private async post<T>(url: string, data: Record<string, any>): Promise<T> {
const httpRequest = http.createHttp();
try {
const response = await httpRequest.request(url, {
method: http.RequestMethod.POST,
header: {
'Content-Type': 'application/json',
'Accept': 'ap... | https://github.com/Zhiyilang074811/enterprise-ai-assistant | c6e79a5af6c8b396f125878a1a8237c4b80dfe04 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildLeaderboardActions | 构建排行榜获取操作序列 | buildLeaderboardActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'getLeaderboard');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少排行榜工作流配置'
);
}
return this.processActions(workflow, {});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildLeaderboardActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConf... | buildLeaderboardActions(config: MangaSourceConfig): Action[] {
const workflow = this.getWorkflow(config, 'getLeaderboard');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少排行榜工作流配置'
);
}
return this.processActions(workflow, {});
} | https://github.com/DaLongZhuaZi/manxia | 823696752ce73ee5172b45042d57bc6d52e4f063 | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | testFloat | 测试 float (f32) | function testFloat() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc(3.14f, 3.14f);
arktest.assertEQ(res, 3.14f);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFloat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declarati... | function testFloat() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc(3.14f, 3.14f);
arktest.assertEQ(res, 3.14f);
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 6ff223a7c1c105c38c540413a0e9a6e1d80ffe61 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/UserViewsApi.ets | arkts | getUserViews | @summary Get user views.
@param {UserViewsApiGetUserViewsRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof UserViewsApi | public getUserViews(requestParameters: UserViewsApiGetUserViewsRequest = {}): Promise<BaseItemDtoQueryResult> {
return this.apiClient.get({
path: "/UserViews",
parameters: requestParameters
})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUserViews AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assign... | public getUserViews(requestParameters: UserViewsApiGetUserViewsRequest = {}): Promise<BaseItemDtoQueryResult> {
return this.apiClient.get({
path: "/UserViews",
parameters: requestParameters
})
} | https://github.com/OHPG/FinSdk | 8fc4932dfa273d1946c03ea69b5a76ea8c8e1363 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceAPIEngine.ets | arkts | request | 执行API请求 | async request(config: APIRequestConfig): Promise<APIResponse> {
logger.info(TAG, `API请求: ${config.method} ${config.url}`);
logger.debug(TAG, `请求body类型: ${typeof config.body}`);
// 内置重试逻辑
const maxRetries = 3;
let lastError: Error | null = null;
for (let attempt = 0; attempt < maxRetries;... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async request(config: APIRequestConfig): Promise<APIResponse> {
logger.info(TAG, `API请求: ${config.method} ${config.url}`);
logger.debug(TAG, `请求body类型: ${typeof config.body}`);
// 内置重试逻辑
const maxRetries = 3;
let lastError: Error | null = null;
for (let attempt = 0; attempt < maxRetries;... | https://github.com/DaLongZhuaZi/manxia | 8ec1db176e96c681200e457c6438e28d3593891e | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginatedResult.ets | arkts | getCurrentPageSize | 获取当前页的数据数量
@returns 当前页数据数量 | getCurrentPageSize(): number {
return this.data.length
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentPageSize 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#sta... | getCurrentPageSize(): number {
return this.data.length
} | https://github.com/offlinecat-dev/OCNetORM | bb6640075c1f7e4e557407723d843dcc6a9fb8a5 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GameControllerService.ets | arkts | isAvailable | 检查 Game Controller Kit 是否可用 | isAvailable(): boolean {
if (!native) {
console.warn('[GameController] Native 模块不可用');
return false;
}
return native.isAvailable();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isAvailable(): boolean {
if (!native) {
console.warn('[GameController] Native 模块不可用');
return false;
}
return native.isAvailable();
} | https://github.com/AlkaidLab/moonlight-harmony | 4b2fb081e16f2a948b2f61726b72f89135659d7f | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FollowManager.ets | arkts | getAllFollows | Get all follow records | private static async getAllFollows(): Promise<IFollowRecord[]> {
try {
if (!FollowManager.preferencesInstance) {
console.error('Preferences not initialized');
return [];
}
const followsStr = await FollowManager.preferencesInstance.get(FollowManager.FOLLOWS_KEY, '[]') as string;
... | 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 getAllFollows AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argumen... | private static async getAllFollows(): Promise<IFollowRecord[]> {
try {
if (!FollowManager.preferencesInstance) {
console.error('Preferences not initialized');
return [];
}
const followsStr = await FollowManager.preferencesInstance.get(FollowManager.FOLLOWS_KEY, '[]') as string;
... | https://github.com/Harrisonls2004/WaterFlow | 27e63c81c641d5d43e41157a1112aaef20fb7597 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | compressImage | 压缩图像数据 - 使用 HarmonyOS image API | async compressImage(
imageData: ArrayBuffer,
algorithm: CompressionAlgorithm,
quality: number
): Promise<ArrayBuffer> {
const startTime = Date.now()
try {
let compressedData: ArrayBuffer
switch (algorithm) {
case CompressionAlgorithm.RLE:
compressedData ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left compressImage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageData AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async compressImage(
imageData: ArrayBuffer,
algorithm: CompressionAlgorithm,
quality: number
): Promise<ArrayBuffer> {
const startTime = Date.now()
try {
let compressedData: ArrayBuffer
switch (algorithm) {
case CompressionAlgorithm.RLE:
compressedData ... | https://github.com/AetheriumSimulator/qemu-hmos | 61e08f7fd522916d23a6888ab3bb3d7624889164 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | getDecimals | Returns the appropriate number of decimals to be used for the provided
number.
@param number
@return | public static getDecimals(number: number): number {
let i: number = Utils.roundToNextSignificant(number);
if (i == Number.MAX_VALUE)
return 0;
return Math.floor(Math.ceil(-Math.log10(i)) + 2);
} | 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 getDecimals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left number AST#identifier#Right AST#:#Left : AS... | public static getDecimals(number: number): number {
let i: number = Utils.roundToNextSignificant(number);
if (i == Number.MAX_VALUE)
return 0;
return Math.floor(Math.ceil(-Math.log10(i)) + 2);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a4fdb2dac0917df6fe3899715572b7f373db84df | gitee |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | transactionExample | ============================================
第五步:事务操作示例
============================================
事务示例 | async function transactionExample(): Promise<void> {
const repository = new Repository('ArticleEntity')
// 基本事务
const result = await repository.transaction(async () => {
const article1 = await createArticle('事务文章1', '内容1', 1)
if (!article1.success) {
throw new Error('创建文章1失败')
}
const arti... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left transactionExample AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ... | async function transactionExample(): Promise<void> {
const repository = new Repository('ArticleEntity')
// 基本事务
const result = await repository.transaction(async () => {
const article1 = await createArticle('事务文章1', '内容1', 1)
if (!article1.success) {
throw new Error('创建文章1失败')
}
const arti... | https://github.com/offlinecat-dev/OCNetORM | 7c53630cd2b79bb51de1b04a42d6f4f8bcb1f0e1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskHelper.ets | arkts | refreshTask | 通过 stop + start 的方式刷新后台长时任务 | private static async refreshTask(context: common.UIAbilityContext): Promise<void> {
try {
await backgroundTaskManager.stopBackgroundRunning(context);
BackgroundTaskHelper.taskRunning = false;
const wantAgentObj: WantAgent = await BackgroundTaskHelper.buildWantAgent(context);
await backgro... | 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 refreshTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left con... | private static async refreshTask(context: common.UIAbilityContext): Promise<void> {
try {
await backgroundTaskManager.stopBackgroundRunning(context);
BackgroundTaskHelper.taskRunning = false;
const wantAgentObj: WantAgent = await BackgroundTaskHelper.buildWantAgent(context);
await backgro... | https://github.com/DaLongZhuaZi/manxia | 3e363bf7d9a4bda73db106a5a1fa2bc6a252c483 | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/JumpUtils.ets | arkts | getContext | 获取 Context,如果未初始化则抛出错误提示 | private static getContext(): common.UIAbilityContext {
if (!JumpUtil.context) {
throw new Error("[JumpUtil] Context 未初始化,请先调用 JumpUtil.init(context)");
}
return JumpUtil.context;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | private static getContext(): common.UIAbilityContext {
if (!JumpUtil.context) {
throw new Error("[JumpUtil] Context 未初始化,请先调用 JumpUtil.init(context)");
}
return JumpUtil.context;
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/JumpUtils.ets#L22-L27 | 3c8a6113ebbdb7fa9b45c140ebcf1d65f686f3b6 | github |
erosTeam/NextE | shared/src/main/ets/parser/EhUconfigParser.ets | arkts | parseRadio | The selected radio's value (== index). 0 when none is checked.
The selected value of a radio group (checked input) or a <select> (selected <option>). 0 if none. | private static parseRadio(html: string, name: string): number {
const re: RegExp = new RegExp(`<input[^>]*name="${name}"[^>]*>`, 'g')
let m: RegExpExecArray | null = re.exec(html)
while (m !== null) {
const tag: string = m[0]
if (tag.includes('checked')) {
const v: string = HtmlSelecto... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseRadio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AS... | private static parseRadio(html: string, name: string): number {
const re: RegExp = new RegExp(`<input[^>]*name="${name}"[^>]*>`, 'g')
let m: RegExpExecArray | null = re.exec(html)
while (m !== null) {
const tag: string = m[0]
if (tag.includes('checked')) {
const v: string = HtmlSelecto... | https://github.com/erosTeam/NextE | 3fc001b5abec36a167468fbaeabc94981da85a88 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | createCbzArchive | 创建CBZ漫画归档文件 | public async createCbzArchive(
chapterInfo: ComicChapterInfo,
options?: Partial<ArchiveOptions>
): Promise<string> {
try {
const mergedOptions: ArchiveOptions = {
compressionLevel: options?.compressionLevel ?? this.defaultOptions.compressionLevel,
includeMetadata: options?.includeM... | 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 createCbzArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapterInfo AST#identifier#Right AST#:#... | public async createCbzArchive(
chapterInfo: ComicChapterInfo,
options?: Partial<ArchiveOptions>
): Promise<string> {
try {
const mergedOptions: ArchiveOptions = {
compressionLevel: options?.compressionLevel ?? this.defaultOptions.compressionLevel,
includeMetadata: options?.includeM... | https://github.com/DaLongZhuaZi/manxia | b73f7746b1d4931dbda3f49bfff5786c2275a72a | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/service/ReportService.ets | arkts | getReportDetail | 获取报表详情 | getReportDetail(id: string): Promise<ReportInfo> {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
id: id,
name: '报表详情',
type: '月度报告',
period: '2024-04',
status: 'completed',
createTime: '2024-04-30 10:30',
updateTi... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getReportDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | getReportDetail(id: string): Promise<ReportInfo> {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
id: id,
name: '报表详情',
type: '月度报告',
period: '2024-04',
status: 'completed',
createTime: '2024-04-30 10:30',
updateTi... | https://github.com/David8Idira/AI-OA | ba548ae1fd49c69a0ef3dbc3c11f1697e86a52ce | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/BookOfMoeScraper.ets | arkts | searchByIsbn | 按ISBN搜索书籍
@param isbn ISBN号 | public async searchByIsbn(isbn: string): Promise<ScraperSearchResult> {
try {
logger.info(TAG, `按ISBN搜索BookOf.Moe: isbn=${isbn}`);
const url = `${BookOfMoeScraper.BASE_URL}/book?isbn=${isbn}`;
const httpRequest = http.createHttp();
const response = await httpRequest.request(url, {
... | 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 searchByIsbn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isbn AST#identifier#Right AST#:#Left : AST#... | public async searchByIsbn(isbn: string): Promise<ScraperSearchResult> {
try {
logger.info(TAG, `按ISBN搜索BookOf.Moe: isbn=${isbn}`);
const url = `${BookOfMoeScraper.BASE_URL}/book?isbn=${isbn}`;
const httpRequest = http.createHttp();
const response = await httpRequest.request(url, {
... | https://github.com/DaLongZhuaZi/manxia | 03196a367f5467a19ddeffab51aae3bea817d12e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | enable | 启用性能分析 | public enable(): void {
this.isEnabled = true;
this.lastUpdateTime = Date.now();
this.lastSampleTime = this.lastUpdateTime;
logger.info(PERFORMANCE_ANALYZER_TAG, 'Performance analyzer enabled');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enable 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_stat... | public enable(): void {
this.isEnabled = true;
this.lastUpdateTime = Date.now();
this.lastSampleTime = this.lastUpdateTime;
logger.info(PERFORMANCE_ANALYZER_TAG, 'Performance analyzer enabled');
} | https://github.com/DaLongZhuaZi/manxia | 6cdc10c1ca6d68310a507e8efd8139201d00eecc | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/utils/HomeIndexCalculator.ets | arkts | formatDateTitle | 将日期转换成首页使用的“今天/昨天/日期”文案。 | static formatDateTitle(dateStr: string): string {
const today = new Date();
const todayStr =
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate()
.toString()
.padStart(2, '0')}`;
if (dateStr === todayStr) {
return '今天';
}
const... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDateTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | static formatDateTitle(dateStr: string): string {
const today = new Date();
const todayStr =
`${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate()
.toString()
.padStart(2, '0')}`;
if (dateStr === todayStr) {
return '今天';
}
const... | https://github.com/ZestBox-18/kitebook-frontend | 3eb847585f8369a431f03058536f83d6c1402948 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxFileManager.ets | arkts | write | 保存KDBX文件
@param path 文件路径
@param content 文件内容
@throws 如果保存失败则抛出异常 | public async write(path: string, content: ArrayBuffer): Promise<void> {
try {
// 写入文件内容
return this.storage.write(path, content);
} catch (error) {
hilog.error(DOMAIN, TAG, 'Failed to save KDBX file: %{public}s', error.message)
throw new Error(error.message);
}
} | 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 write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right... | public async write(path: string, content: ArrayBuffer): Promise<void> {
try {
// 写入文件内容
return this.storage.write(path, content);
} catch (error) {
hilog.error(DOMAIN, TAG, 'Failed to save KDBX file: %{public}s', error.message)
throw new Error(error.message);
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxFileManager.ets#L76-L84 | b563fbafd8e6986f79679cdb0bb211c0d9613f85 | github |
openharmony/codelabs | ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/components/ImagePicker.ets | arkts | saveCapturedImage | Buffer 保存逻辑(保持不变,这部分是稳的) | saveCapturedImage(srcUri: string) {
let srcFile: fs.File | null = null;
let destFile: fs.File | null = null;
try {
srcFile = fs.openSync(srcUri, fs.OpenMode.READ_ONLY);
const fileStat = fs.statSync(srcFile.fd);
const buffer = new ArrayBuffer(fileStat.size);
fs.readSync(srcFile.fd,... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveCapturedImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left srcUri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier... | saveCapturedImage(srcUri: string) {
let srcFile: fs.File | null = null;
let destFile: fs.File | null = null;
try {
srcFile = fs.openSync(srcUri, fs.OpenMode.READ_ONLY);
const fileStat = fs.statSync(srcFile.fd);
const buffer = new ArrayBuffer(fileStat.size);
fs.readSync(srcFile.fd,... | https://gitcode.com/openharmony/codelabs | ea13d6cf2ea508517f09218c4489bd7126093154 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | clearCanvas | Clear canvas content. | clearCanvas(): void {
if (this.ctx !== undefined) {
this.ctx.clearRect(0, 0, this.displayWidth, this.displayHeight);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearCanvas 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#... | clearCanvas(): void {
if (this.ctx !== undefined) {
this.ctx.clearRect(0, 0, this.displayWidth, this.displayHeight);
}
} | https://gitee.com/openharmony/codelabs.git | 396b924e15fc400016428f5c34178d957b5d7ff1 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/CryptoUtils.ets | arkts | toBase64 | 将加密数据转换为Base64编码, [iv, 16] + [data, n]
@param data 加密数据
@param iv 随机IV
@returns Base64编码 | private static toBase64(data: Uint8Array, iv: Uint8Array): string {
const combined = new Uint8Array(iv.length + data.length);
combined.set(iv, 0);
combined.set(data, iv.length);
return new util.Base64Helper().encodeToStringSync(combined);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left toBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#... | private static toBase64(data: Uint8Array, iv: Uint8Array): string {
const combined = new Uint8Array(iv.length + data.length);
combined.set(iv, 0);
combined.set(data, iv.length);
return new util.Base64Helper().encodeToStringSync(combined);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CryptoUtils.ets#L184-L189 | e3432e9e6bc3108709c1f8e0e230dac672b6ecfa | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ToolRegistry.ets | arkts | getToolCount | 获取已注册工具数量 | getToolCount(): number {
return this.tools.size
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getToolCount 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... | getToolCount(): number {
return this.tools.size
} | https://github.com/LongLiveY96/chatcube | 1e9dda1e5e9b1738e8ae9c926d4d9b33b896c0ea | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getCircleBox | returns the circlebox, the boundingbox of the pie-chart slices
@return | public getCircleBox(): MyRect {
return this.mCircleBox;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCircleBox 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 MyRect AS... | public getCircleBox(): MyRect {
return this.mCircleBox;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5c8a0542e529ae3a48a0abc1349ec57529084984 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | parseJsonElement | Parses a JSON string with a reviver function and returns a JsonElement.
@param {string} text - The JSON string to parse
@param {(key: string, value: JsonElement) => JsonElement} reviver - Function to transform values
@param {jsonx.ParseOptions} [options] - BigInt parsing options
@returns {JsonElement} The parsed JSON e... | public static parseJsonElement(text: string, reviver: (key: string, value: jsonx.JsonElement) => jsonx.JsonElement,
options?: jsonx.ParseOptions): jsonx.JsonElement {
return new UnifiedJsonParser(text, reviver, options).parse()
} | 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 parseJsonElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left :... | public static parseJsonElement(text: string, reviver: (key: string, value: jsonx.JsonElement) => jsonx.JsonElement,
options?: jsonx.ParseOptions): jsonx.JsonElement {
return new UnifiedJsonParser(text, reviver, options).parse()
} | https://gitcode.com/iop123123/arkts-static-skills | eb94d3b48f7de67a07e0307845359c8372534a59 | gitcode |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | detectLowEndDevice | v26: 低端设备检测逻辑
支持 H264 硬件编解码的设备视为高端设备,无需降级
仅不支持硬件编解码(只能用 VP8 软编码)的设备才降级 | private detectLowEndDevice(): boolean {
try {
const h264Supported: boolean = isCodecSupported('H264');
LogUtil.info(`[MediaStream] 设备检测:H264硬件编解码=${h264Supported}, 低端=${!h264Supported}`);
// 支持 H264 硬件编解码 → 高端设备,不降级
// 不支持 → 只能用 VP8 软编码,视为低端设备,需要降级
return !h264Supported;
} catch ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectLowEndDevice 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 boo... | private detectLowEndDevice(): boolean {
try {
const h264Supported: boolean = isCodecSupported('H264');
LogUtil.info(`[MediaStream] 设备检测:H264硬件编解码=${h264Supported}, 低端=${!h264Supported}`);
// 支持 H264 硬件编解码 → 高端设备,不降级
// 不支持 → 只能用 VP8 软编码,视为低端设备,需要降级
return !h264Supported;
} catch ... | https://github.com/tdcare/tdwebrtc | 4d9ad6b4b0a67cfd04b7ee87b41ea80154ea1f78 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/WhereCondition.ets | arkts | or | 设置逻辑连接符为 OR
@returns 当前实例 | or(): WhereCondition {
this.logicalOperator = LogicalOperator.OR
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left or 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 WhereCondition AST#identifier#Right AST#ERROR#Right AST#sta... | or(): WhereCondition {
this.logicalOperator = LogicalOperator.OR
return this
} | https://github.com/offlinecat-dev/OCNetORM | f0efc79ee2936d641d29dd91b5d72ea427dd3021 | github |
HarmonyOS_Samples/BestPracticeSnippets | PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets | arkts | isInstanceNotNull | [StartExclude audio_player_service] | public static isInstanceNotNull(): boolean {
return AudioPlayerService.instance !== null;
} | 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 isInstanceNotNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public static isInstanceNotNull(): boolean {
return AudioPlayerService.instance !== null;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 2367a561504a344b0ff10b8ae3cd88b35ec88cdc | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets | arkts | onWindowStageCreate | window状态改变回调
@param windowStage | onWindowStageCreate(windowStage: window.WindowStage) {
FlutterManager.getInstance().pushWindowStage(this, windowStage);
this.delegate?.initWindow();
this.mainWindow = windowStage.getMainWindowSync();
try {
windowStage.on('windowStageEvent', (data) => {
let stageEventType: window.WindowSt... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left win... | onWindowStageCreate(windowStage: window.WindowStage) {
FlutterManager.getInstance().pushWindowStage(this, windowStage);
this.delegate?.initWindow();
this.mainWindow = windowStage.getMainWindowSync();
try {
windowStage.on('windowStageEvent', (data) => {
let stageEventType: window.WindowSt... | https://gitee.com/openharmony-sig/flutter_engine.git | d9542fb1ca6a740db5e99d0434a96ed5ebe481c2 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/LegendRenderer.ets | arkts | drawLabel | Draws the provided label at the given position.
@param c to draw with
@param x
@param y
@param label the label to draw
protected void drawLabel(Canvas c, float x, float y, String label) { | protected drawLabel(c: CanvasRenderingContext2D, x: number, y: number, label: string): void {
LogUtil.log("-------------------sLabels drawLabel: " + label)
Utils.resetContext2DWithoutLine(c, this.mLegendLabelPaint)
c.fillText(label, x, y)
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | protected drawLabel(c: CanvasRenderingContext2D, x: number, y: number, label: string): void {
LogUtil.log("-------------------sLabels drawLabel: " + label)
Utils.resetContext2DWithoutLine(c, this.mLegendLabelPaint)
c.fillText(label, x, y)
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ab4c898db4b8d9cc7e2041a544ffd5cb0cd6fd68 | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/DateUtil.ets | arkts | getCurrentDate | 获取当前日期 格式: YYYY-MM-DD | static getCurrentDate(): string {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#... | static getCurrentDate(): string {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 675e3e499739297ea6183fd3636e51f8dabd1854 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AccountDAO.ets | arkts | updateBalance | 更新账户余额 (原子的)
@param accountId 账户ID
@param amount 变动金额 (正数增加,负数减少) | static async updateBalance(accountId: number, amount: number) {
const store = DatabaseManager.getDatabase();
const sql = `UPDATE accounts SET balance = balance + ? WHERE account_id = ?`;
await store.executeSql(sql, [amount, accountId]);
console.log(`[AccountDAO] 余额更新: accountId=${accountId}, delta=${a... | 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 updateBalance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accountId AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async updateBalance(accountId: number, amount: number) {
const store = DatabaseManager.getDatabase();
const sql = `UPDATE accounts SET balance = balance + ? WHERE account_id = ?`;
await store.executeSql(sql, [amount, accountId]);
console.log(`[AccountDAO] 余额更新: accountId=${accountId}, delta=${a... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 19f14610357bc3466f5434e2240e8666f7886bfb | github |
HarmonyOS_Samples/BestPracticeSnippets | ClickResponseOptimization/entry/src/main/ets/pages/VisionOptPage.ets | arkts | onPageShow | [End pagetransition] | onPageShow() {
hiTraceMeter.finishTrace("clickChat", 1);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
hiTraceMeter.finishTrace("clickChat", 1);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | b83331e0db60bf087a13a1d832c034b69ef5dce7 | gitcode |
openharmony/applications_call | entry/src/main/ets/model/CallDataManager.ets | arkts | update | update callList and callData callTimeList
`
@param { object } callData | public update(callData) {
const { callState, callId } = callData;
if (callId === undefined || callId === null) {
LogUtils.i(TAG, 'callId is not exist');
return;
}
const targetObj = this.callList.find((v) => v.callId === callId);
LogUtils.i(TAG, 'update :')
if (targetObj) {
co... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callData AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#... | public update(callData) {
const { callState, callId } = callData;
if (callId === undefined || callId === null) {
LogUtils.i(TAG, 'callId is not exist');
return;
}
const targetObj = this.callList.find((v) => v.callId === callId);
LogUtils.i(TAG, 'update :')
if (targetObj) {
co... | https://gitee.com/openharmony/applications_call.git | 03a17fff40fdcd65f45aa3dda374ff3b313d46e2 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_int.ets | arkts | main | ---
desc: check postfix increment for integer operand
--- | function main(): void {
let value: int = {{v.value}}
let result: int = value++
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: int = {{v.value}}
let result: int = value++
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 570a39a6faecbc7ab2f5016ae74a10473d11a29a | gitee |
tdcare/tdwebrtc | src/main/ets/utils/Base64Util.ets | arkts | encodeToStr | 编码,通过输入参数编码后输出对应文本。
@param array
@returns | static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> {
const base64 = new util.Base64Helper();
return base64.encodeToString(array, options);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left encodeToStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uin... | static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> {
const base64 = new util.Base64Helper();
return base64.encodeToString(array, options);
} | https://github.com/tdcare/tdwebrtc | 90db7b79abf2ac8a0ddc9ece945e062c57b09b0d | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/RequireAwait/ets/requireAwaitNoReport.ets | arkts | numberOne | Async function declaration with await | async function numberOne(): Promise<number> {
return await 1;
}; | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left numberOne AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async function numberOne(): Promise<number> {
return await 1;
}; | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 9da8ab371f80b2a781d353815f872d0414f543c9 | github |
azhu0001/localsend-harmony | entry/src/main/ets/service/flush/FlushService.ets | arkts | flush | 添加到文件写入队列
@param flush | flush(flush: FlushTask) {
this.add(flush)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left flush AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left flush AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FlushTask AST#identifier#Right AST... | flush(flush: FlushTask) {
this.add(flush)
} | https://gitcode.com/azhu0001/localsend-harmony | d8acc5834770313fa9f33e11694ea4815c08e63b | gitcode |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/view/HomeTopBar.ets | arkts | build | Picks among narrow two-row, narrow single-row+search, or wide title+search layouts. | build() {
if (this.breakpointEnv.widthBreakpoint === WidthBreakpoint.WIDTH_SM &&
this.breakpointEnv.heightBreakpoint === HeightBreakpoint.HEIGHT_MD) {
Column({ space: 12 }) {
Row() {
Text($r('app.string.home_page_title'))
.fontSize(new BreakpointType(28, 30, 32, 32).getVa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left i... | build() {
if (this.breakpointEnv.widthBreakpoint === WidthBreakpoint.WIDTH_SM &&
this.breakpointEnv.heightBreakpoint === HeightBreakpoint.HEIGHT_MD) {
Column({ space: 12 }) {
Row() {
Text($r('app.string.home_page_title'))
.fontSize(new BreakpointType(28, 30, 32, 32).getVa... | https://gitcode.com/HarmonyOS_Samples/MusicHome | a4252f9fc6cbbd81f1bbf815070415264c78fb9a | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Matrix.ets | arkts | postScale | 在矩阵上应用缩放变换。
@param scaleX - 水平方向的缩放因子。
@param scaleY - 垂直方向的缩放因子。
@param centerX - 可选参数,缩放的中心点的X坐标。
@param centerY - 可选参数,缩放的中心点的Y坐标。 | public postScale(scaleX: number, scaleY: number, centerX?: number, centerY?: number) {
// 缩放矩阵的水平和垂直缩放因子
this.data[Matrix.MSCALE_X] *= scaleX;
this.data[Matrix.MSCALE_Y] *= scaleY;
// 如果提供了中心点的X坐标,则按照中心点缩放
if (centerX != null && centerX != undefined) {
this.data[Matrix.MTRANS_X] = scaleX * ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left postScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scaleX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public postScale(scaleX: number, scaleY: number, centerX?: number, centerY?: number) {
// 缩放矩阵的水平和垂直缩放因子
this.data[Matrix.MSCALE_X] *= scaleX;
this.data[Matrix.MSCALE_Y] *= scaleY;
// 如果提供了中心点的X坐标,则按照中心点缩放
if (centerX != null && centerX != undefined) {
this.data[Matrix.MTRANS_X] = scaleX * ... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 22c7ce7f3e5f75a96d268fa99ddb2d48b91b4ccb | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/ui/web_ui.ets | arkts | switch_emitter | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
监听函数 //
//////////
开启 / 关闭 广播监听 // | switch_emitter(status: boolean) {
// 开启 //
if (status) {
// 元数据 //
emitter.on({ eventId: 712 }, async (data: emitter.EventData) => {
this.web_ui_core.runJavaScript(`set_meta(${JSON.stringify(data.data!.meta)})`)
const img_base64: string = await image_to_base64(data.data!.image[1]... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switch_emitter 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#R... | switch_emitter(status: boolean) {
// 开启 //
if (status) {
// 元数据 //
emitter.on({ eventId: 712 }, async (data: emitter.EventData) => {
this.web_ui_core.runJavaScript(`set_meta(${JSON.stringify(data.data!.meta)})`)
const img_base64: string = await image_to_base64(data.data!.image[1]... | https://github.com/Nekofox-POT/LinMusic | b617268540918b418cb14d04eb73fe3d500805ff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | initCacheDir | 初始化缓存目录
[改进] 优先使用Download同步目录下的novel文件夹
当Download目录未配置时,回退到沙箱目录 | private async initCacheDir(): Promise<void> {
if (this.isInitialized) return;
try {
// 优先检查Download同步目录是否已配置
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (downloadDirPath) {
// 尝试使用Download目录下的novel文件夹
const novelDir = `${downloadDirPa... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | private async initCacheDir(): Promise<void> {
if (this.isInitialized) return;
try {
// 优先检查Download同步目录是否已配置
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (downloadDirPath) {
// 尝试使用Download目录下的novel文件夹
const novelDir = `${downloadDirPa... | https://github.com/DaLongZhuaZi/manxia | b477bcaa142451b2d16b882d2e9ee1ebbf551ab4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets | arkts | runQuickTest | 运行快速测试
测试引导管理器的基本功能 | public static async runQuickTest(): Promise<boolean> {
try {
logger.info(TAG, '🚀 开始快速测试...');
// 测试1: 初始化
logger.info(TAG, '测试1: 初始化引导管理器');
await this.guideManager.initialize();
logger.info(TAG, '✅ 初始化成功');
// 测试2: 获取状态
logger.info(TAG, '测试2: 获取当前状态');
await thi... | 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 runQuickTest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#R... | public static async runQuickTest(): Promise<boolean> {
try {
logger.info(TAG, '🚀 开始快速测试...');
// 测试1: 初始化
logger.info(TAG, '测试1: 初始化引导管理器');
await this.guideManager.initialize();
logger.info(TAG, '✅ 初始化成功');
// 测试2: 获取状态
logger.info(TAG, '测试2: 获取当前状态');
await thi... | https://github.com/DaLongZhuaZi/manxia | 03642f6b433c7ab6783cac21f9bb83785fd80571 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ModelCapabilityMatcher.ets | arkts | preloadCache | 启动时后台预热 models.dev 缓存(供 logo 解析使用)
尊重 MODELS_DEV_ENABLED 偏好开关 | async preloadCache(): Promise<boolean> {
const prefs = getPreferencesService()
const enabled = await prefs.getBoolean(PreferenceKeys.MODELS_DEV_ENABLED, true)
if (!enabled) {
return false
}
return await this.ensureCache()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left preloadCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async preloadCache(): Promise<boolean> {
const prefs = getPreferencesService()
const enabled = await prefs.getBoolean(PreferenceKeys.MODELS_DEV_ENABLED, true)
if (!enabled) {
return false
}
return await this.ensureCache()
} | https://github.com/LongLiveY96/chatcube | 0e43d5cea889dbeba822e9867f909a3e74863337 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/DefaultParser.ets | arkts | handleLongOption | Handles the following tokens:
--L --L=V --L V --l
@param token the command line token to handle | private handleLongOption(token: string): void {
if (token.indexOf('=') == -1) {
this.handleLongOptionWithoutEqual(token);
} else {
this.handleLongOptionWithEqual(token);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleLongOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private handleLongOption(token: string): void {
if (token.indexOf('=') == -1) {
this.handleLongOptionWithoutEqual(token);
} else {
this.handleLongOptionWithEqual(token);
}
} | https://gitee.com/openharmony-sig/commons-cli.git | 56b3165a9b7d8cced5f36752177f0ba0a99a01fe | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | getStructuredData | 获取结构化数据 | getStructuredData(): StructuredReceiptData | null {
if (this.structuredDataJson === '') {
return null;
}
try {
const parsed = JSON.parse(this.structuredDataJson) as StructuredReceiptData;
return parsed;
} catch (e) {
return null;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStructuredData 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 StructuredReceipt... | getStructuredData(): StructuredReceiptData | null {
if (this.structuredDataJson === '') {
return null;
}
try {
const parsed = JSON.parse(this.structuredDataJson) as StructuredReceiptData;
return parsed;
} catch (e) {
return null;
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f97c0c6b4f36a4d4b47fafb260656827e6201931 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | with | Creates a copy with replaced value on index
@param index
@param value
@returns an Int8Array with replaced value on index | public with(index: number, value: number): Int8Array {
return this.with(index as int, value as double as int as byte)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: number, value: number): Int8Array {
return this.with(index as int, value as double as int as byte)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bb9b02e32a89d8dfaba155a932bafa0e107931da | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | pushArray | Adds the specified elements to the end of an array and returns the new length of the array.
@param { T[] } val The elements to add to the end of the array.
@returns { int } The new length of the array upon which the method was called.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public pushArray(...val: T[]): int {
const length: int = val.length
this.ensureUnusedCapacity(length)
for (let i = 0; i < length; i++) {
this.buffer[this.actualLength + i] = val[i]
}
this.actualLength += length
return this.actualLength
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#identifier#Left val AST#identifier#Right AST#spread_element#Right AST... | public pushArray(...val: T[]): int {
const length: int = val.length
this.ensureUnusedCapacity(length)
for (let i = 0; i < length; i++) {
this.buffer[this.actualLength + i] = val[i]
}
this.actualLength += length
return this.actualLength
} | https://gitcode.com/iop123123/arkts-static-skills | 0a4ed2b4d75ad97f657ed1a00cc575c971db60a0 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/CryptoService.ets | arkts | decryptV2 | v2 解密:PBKDF2 派生密钥 + AES-256-GCM | private static async decryptV2(data: Uint8Array, password?: string): Promise<string> {
const minLen = MAGIC_SIZE + PBKDF2_SALT_SIZE + GCM_NONCE_SIZE + GCM_TAG_SIZE;
if (data.length < minLen) {
throw new Error('v2 加密数据太短');
}
const pwd = password || DEFAULT_PASSWORD;
let pos = MAGIC_SIZE;
... | 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 decryptV2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data ... | private static async decryptV2(data: Uint8Array, password?: string): Promise<string> {
const minLen = MAGIC_SIZE + PBKDF2_SALT_SIZE + GCM_NONCE_SIZE + GCM_TAG_SIZE;
if (data.length < minLen) {
throw new Error('v2 加密数据太短');
}
const pwd = password || DEFAULT_PASSWORD;
let pos = MAGIC_SIZE;
... | https://github.com/AlkaidLab/moonlight-harmony | 02bffc622e296933c7560138981fda3557249045 | github |
Joker-x-dev/CoolMallArkTS | core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets | arkts | parseSelectedGoodsList | 解析已选商品列表
@param {SelectedGoodsJson[]} jsonList JSON 数据列表
@returns {SelectedGoods[]} 已选商品列表 | private parseSelectedGoodsList(jsonList: SelectedGoodsJson[]): SelectedGoods[] {
const result: SelectedGoods[] = [];
for (const item of jsonList) {
const selectedGoods = new SelectedGoods();
selectedGoods.goodsId = item.goodsId ?? 0;
selectedGoods.count = item.count ?? 0;
// 解析商品信息
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSelectedGoodsList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsonList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#su... | private parseSelectedGoodsList(jsonList: SelectedGoodsJson[]): SelectedGoods[] {
const result: SelectedGoods[] = [];
for (const item of jsonList) {
const selectedGoods = new SelectedGoods();
selectedGoods.goodsId = item.goodsId ?? 0;
selectedGoods.count = item.count ?? 0;
// 解析商品信息
... | https://github.com/Joker-x-dev/CoolMallArkTS | fe107a17c3ac2b4dc31c8f8964c74e2ba068f584 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | cacheChapter | 缓存单个章节内容(保存为txt文件) | async cacheChapter(
sourceId: string,
bookId: string,
chapter: LegadoChapter
): Promise<boolean> {
try {
// 确保缓存目录已初始化
await this.ensureInitialized();
if (this.getSourceType(sourceId) === LegadoBookSourceType.AUDIO) {
return await this.cacheAudioChapter(sourceId, bookId, c... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cacheChapter AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async cacheChapter(
sourceId: string,
bookId: string,
chapter: LegadoChapter
): Promise<boolean> {
try {
// 确保缓存目录已初始化
await this.ensureInitialized();
if (this.getSourceType(sourceId) === LegadoBookSourceType.AUDIO) {
return await this.cacheAudioChapter(sourceId, bookId, c... | https://github.com/DaLongZhuaZi/manxia | bdc8d3142521336afe68b1d7ed465fa0f96ef0b5 | github |
LZZLHY/hlib | entry/src/main/ets/api/ZLibraryClient.ets | arkts | loginWithToken | Token 登录:以已知的 userId / userKey 直接拉 profile。 | async loginWithToken(userId: string, userKey: string): Promise<User> {
this.http.setAuth(userId, userKey);
return await this.getProfile();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loginWithToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#L... | async loginWithToken(userId: string, userKey: string): Promise<User> {
this.http.setAuth(userId, userKey);
return await this.getProfile();
} | https://github.com/LZZLHY/hlib | 388f4998a318f1681e165761622ce3cbba2547b6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | buildCertificate | 构造完整的 X.509 证书 | private static buildCertificate(tbsCert: Uint8Array, signature: Uint8Array): Uint8Array {
const sigAlg = CryptoUtil.getSha256WithRsaAlgorithm();
const sigBitString = CryptoUtil.asn1BitString(signature);
let certContent = CryptoUtil.concatBytes(tbsCert, sigAlg);
certContent = CryptoUtil.concatBytes(ce... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left buildCertificate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tbsCert AST#identifier#Right AST#:#... | private static buildCertificate(tbsCert: Uint8Array, signature: Uint8Array): Uint8Array {
const sigAlg = CryptoUtil.getSha256WithRsaAlgorithm();
const sigBitString = CryptoUtil.asn1BitString(signature);
let certContent = CryptoUtil.concatBytes(tbsCert, sigAlg);
certContent = CryptoUtil.concatBytes(ce... | https://github.com/AlkaidLab/moonlight-harmony | 08595cbc4282ae720540fa6506ce0fb6b1350ac2 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryCache.ets | arkts | encodeKeyPart | 生成缓存键
对键组件进行编码,避免分隔符冲突
@param entityName 实体名称
@param id 实体主键值
@returns 缓存键 | private encodeKeyPart(value: string): string {
return encodeURIComponent(value)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left encodeKeyPart 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#Lef... | private encodeKeyPart(value: string): string {
return encodeURIComponent(value)
} | https://github.com/offlinecat-dev/OCNetORM | eafb1795e330df3b6c8d5d95b04b7dd9d40c22fd | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_complement/bitwise_complement_short.ets | arkts | main | ---
desc: check bitwise complement of short integer
--- | function main(): void {
const v: short = {{v.value}}
assert ~(v) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const v: short = {{v.value}}
assert ~(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4bd57f67e07f64c72969bab41997ea0e91ed60b0 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_char.ets | arkts | main | ---
desc: check postfix decrement for char operand
--- | function main(): void {
let value: char = {{v.value}}
let result: char = value--
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: char = {{v.value}}
let result: char = value--
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 96372a4f85f3284dc77bd3fb31272234ae5373f7 | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/UserAuthenticationDemo.ets | arkts | getUserAuthAvailableStatus | userAuth.getAvailableStatus() - 用于查询系统是否支持指定的用户认证能力(如果不具备指定的用户认证能力,则会抛出异常)
authType - 认证类型(UserAuthType 枚举)
PIN - 密码
FACE - 人脸
FINGERPRINT - 指纹
authTrustLevel - 认证等级(AuthTrustLevel 枚举)
ATL1 - 一般等级
ATL2 - 应用级
ATL3 - 设备级
ATL4 - 支付级 | getUserAuthAvailableStatus() {
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.PIN, userAuth.AuthTrustLevel.ATL4);
this.message += `PIN, ATL4 ok\n`
} catch (e) {
this.message += `PIN, ATL4 error: ${JSON.stringify(e)}\n`
}
try {
userAuth.getAvailableStatus(userAuth.User... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getUserAuthAvailableStatus 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#stateme... | getUserAuthAvailableStatus() {
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.PIN, userAuth.AuthTrustLevel.ATL4);
this.message += `PIN, ATL4 ok\n`
} catch (e) {
this.message += `PIN, ATL4 error: ${JSON.stringify(e)}\n`
}
try {
userAuth.getAvailableStatus(userAuth.User... | https://github.com/webabcd/HarmonyDemo | 09ae00b594ad9831ee9bc25176e7118e036d48bd | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/ColorUtil.ets | arkts | getDeepenImmersionColor | 通过调整饱和度和亮度生成沉浸式背景色
@param rRGB 红色部分 (0-255)
@param gRGB 绿色部分 (0-255)
@param bRGB 蓝色部分 (0-255)
@returns 调整后的RGB值 as [r, g, b] | public static getDeepenImmersionColor(rRGB: number, gRGB: number, bRGB: number): number[] {
const hsb = ColorUtil.rgbToHsb(rRGB, gRGB, bRGB)
let saturation = hsb[ColorUtil.SATURATION_INDEX]
let brightness = hsb[ColorUtil.BRIGHTNESS_INDEX]
// 增加饱和度
saturation += ColorUtil.SATURATION_INCREMENT
/... | 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 getDeepenImmersionColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rRGB AST#identifier#Right AST#:... | public static getDeepenImmersionColor(rRGB: number, gRGB: number, bRGB: number): number[] {
const hsb = ColorUtil.rgbToHsb(rRGB, gRGB, bRGB)
let saturation = hsb[ColorUtil.SATURATION_INDEX]
let brightness = hsb[ColorUtil.BRIGHTNESS_INDEX]
// 增加饱和度
saturation += ColorUtil.SATURATION_INCREMENT
/... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 2c0be5325a4cbfa3e14c85ddec7c6b348ffd73e4 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.