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 |
|---|---|---|---|---|---|---|---|---|---|---|
LJ666-ui/harmony-health-care | entry/src/main/ets/core/PatientMonitorController.ets | arkts | getDeviceStatus | 获取监护仪设备状态 | public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> {
let status = this.statusCache.get(deviceId);
// 如果没有缓存状态,创建默认状态
if (!status) {
const properties: Map<string, DeviceProperty> = new Map();
const vitalSigns = this.generateVitalSigns();
properties.set('heartRate', {
... | 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 getDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left... | public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> {
let status = this.statusCache.get(deviceId);
// 如果没有缓存状态,创建默认状态
if (!status) {
const properties: Map<string, DeviceProperty> = new Map();
const vitalSigns = this.generateVitalSigns();
properties.set('heartRate', {
... | https://github.com/LJ666-ui/harmony-health-care | cedfc702e2f95698587e7e9ab55fbc2cc385dfa2 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets | arkts | getCenterY | Get the center point of y.
@returns | getCenterY(): number {
return (this.top + this.getHeight() / 2);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCenterY 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_b... | getCenterY(): number {
return (this.top + this.getHeight() / 2);
} | https://gitee.com/openharmony/codelabs.git | b6317b18f47010b8d4e43f45304fd5fbc261bed0 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | updateStatus | 更新审批记录 | static async updateStatus(
approvalId: number,
status: string,
approverId: number,
approverName: string,
comment: string
): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucke... | 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 approvalId AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static async updateStatus(
approvalId: number,
status: string,
approverId: number,
approverName: string,
comment: string
): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const values: relationalStore.ValuesBucke... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5be112e4d9811ac40b1ea1dd963f9564f3c26bf7 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/search/search.ets | arkts | onBackPress | 监听back事件,若已经搜索则返回先清空搜索结果
return值代表是否按照系统默认的back指令 | onBackPress() {
console.log('SearchPage: back: ' + this.inputText)
//当没有搜索时,使用系统默认back指令,返回false
if (this.inputText == '') {
console.log('SearchPage: back')
return false
} else {
//当已搜索时,清空搜索结果,返回true,不使用系统默认back指令
console.log('SearchPage: back: clear')
this.inputText = '... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | onBackPress() {
console.log('SearchPage: back: ' + this.inputText)
//当没有搜索时,使用系统默认back指令,返回false
if (this.inputText == '') {
console.log('SearchPage: back')
return false
} else {
//当已搜索时,清空搜索结果,返回true,不使用系统默认back指令
console.log('SearchPage: back: clear')
this.inputText = '... | https://gitee.com/openharmony-sig/online_event.git | 2de75e4a4aecb6510e2f9182ad54e417ec25903b | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/CandleDataSet.ets | arkts | setShadowColor | Sets shadow color for all entries
@param shadowColor | public setShadowColor(shadowColor: number): void {
this.mShadowColor = shadowColor;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setShadowColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shadowColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | public setShadowColor(shadowColor: number): void {
this.mShadowColor = shadowColor;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e44adb930a965bb448010e848e855e0a268109b7 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseManager.ets | arkts | closeDatabase | 关闭数据库连接 | static async closeDatabase(): Promise<void> {
if (DatabaseManager.db) {
// HarmonyOS 的 RdbStore 没有显式的 close 方法
// 数据库会在应用退出时自动关闭
DatabaseManager.db = null;
DatabaseManager.isInitialized = false;
console.log('[DatabaseManager] 数据库连接已清理');
}
} | 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 closeDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | static async closeDatabase(): Promise<void> {
if (DatabaseManager.db) {
// HarmonyOS 的 RdbStore 没有显式的 close 方法
// 数据库会在应用退出时自动关闭
DatabaseManager.db = null;
DatabaseManager.isInitialized = false;
console.log('[DatabaseManager] 数据库连接已清理');
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 47131e709ac314b2c2ef33e0c672493e8e345f6e | github |
HarmonyOS_Samples/MultiVideoApplication | features/multivideodetail/src/main/ets/view/VideoDetail.ets | arkts | exitFullScreen | Exits fullscreen and restores window to maximized or floating when applicable. | exitFullScreen(): void {
this.isFullScreen = false;
try {
if (this.windowUtil !== undefined) {
this.immersiveTypeCurrent = this.windowUtil.mainWindow.getWindowStatus();
}
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `Window getWindowStatus failed, e... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exitFullScreen 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... | exitFullScreen(): void {
this.isFullScreen = false;
try {
if (this.windowUtil !== undefined) {
this.immersiveTypeCurrent = this.windowUtil.mainWindow.getWindowStatus();
}
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `Window getWindowStatus failed, e... | https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication | c015948b3f55cc3057ff5d246df0fa92ef91d0f2 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | toDouble | Returns the primitive as double value
@param { double } value value to cast
@returns { double }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toDouble(value: double): double {
return value;
} | 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 toDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#... | public static toDouble(value: double): double {
return value;
} | https://gitcode.com/iop123123/arkts-static-skills | b5437bcdfe4e75623b75b216447257a8f9364b22 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | removeByRange | Deletes elements from a range, including the start value but not the end value.
@param fromIndex - the start index.
@param toIndex - the end index. | public removeByRange(fromIndex: int, toIndex: int): void {
this.checkEmptyContainer();
this.checkRange(fromIndex, toIndex);
for (let i: int = fromIndex, j: int = toIndex; j < this.length; i++, j++) {
this.buffer[i] = this.buffer[j];
}
this.buffer.length -= toInd... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeByRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fromIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#ident... | public removeByRange(fromIndex: int, toIndex: int): void {
this.checkEmptyContainer();
this.checkRange(fromIndex, toIndex);
for (let i: int = fromIndex, j: int = toIndex; j < this.length; i++, j++) {
this.buffer[i] = this.buffer[j];
}
this.buffer.length -= toInd... | https://gitcode.com/iop123123/arkts-static-skills | 82854d701910da1c6dfe4011cd654bfeae72e18c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | includes | Determines whether Float32Array includes a certain element, returning true or false as appropriate
@param { number } searchElement - The element to search for
@param { int } [fromIndex] - The position in this array at which to begin searching for searchElement.
If fromIndex is undefined, the search starts at index 0.
@... | public includes(searchElement: number, fromIndex?: int): boolean {
if (isNaN(searchElement)) {
return this.containsNaN(asIntOrDefault(fromIndex, 0))
}
return this.indexOf(searchElement, asIntOrDefault(fromIndex, 0)) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | public includes(searchElement: number, fromIndex?: int): boolean {
if (isNaN(searchElement)) {
return this.containsNaN(asIntOrDefault(fromIndex, 0))
}
return this.indexOf(searchElement, asIntOrDefault(fromIndex, 0)) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | bdb581d89f2088c788768eca45148b067e4960db | gitcode |
veaba/EsptouchForHarmony | entry/src/main/ets/esptouch/provision/APProvisioner.ets | arkts | connectTCP | Create TCP connection to ESP32 | private async connectTCP(): Promise<void> {
this.tcpSocket = socket.constructTCPSocketInstance();
return new Promise<void>((resolve: () => void, reject: (reason: Error) => void): void => {
let timer: number = setTimeout((): void => {
this.closeTCPSocket();
reject(new Error('TCP connect ... | 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 connectTCP AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | private async connectTCP(): Promise<void> {
this.tcpSocket = socket.constructTCPSocketInstance();
return new Promise<void>((resolve: () => void, reject: (reason: Error) => void): void => {
let timer: number = setTimeout((): void => {
this.closeTCPSocket();
reject(new Error('TCP connect ... | https://github.com/veaba/EsptouchForHarmony | 08552671f50e2d2de0f166d702069ab0e6a88983 | github |
xiebyapps/ClipLink | entry/src/main/ets/services/ConfigService.ets | arkts | loadConfig | Load configuration from preferences | async loadConfig(): Promise<AppConfig> {
if (this.loadingPromise) {
return this.loadingPromise;
}
this.loadingPromise = this.loadConfigInternal();
try {
return await this.loadingPromise;
} finally {
this.loadingPromise = null;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadConfig 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 loadConfig(): Promise<AppConfig> {
if (this.loadingPromise) {
return this.loadingPromise;
}
this.loadingPromise = this.loadConfigInternal();
try {
return await this.loadingPromise;
} finally {
this.loadingPromise = null;
}
} | https://github.com/xiebyapps/ClipLink | 6ce7ab4b46b28fcd8aaf9c4c49a36eed4d0d2dad | github |
openharmony/arkui_ace_engine | examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets | arkts | runAllDrawableDescriptorTests | ===================== 综合测试 ===================== | runAllDrawableDescriptorTests() {
this.testDrawableDescriptorConstructor();
this.testDrawableDescriptorGetPixelMap();
this.testDrawableDescriptorLoadSync();
this.testDrawableDescriptorLoad();
this.testLoadedResultFromLoadSync();
this.testLoadedResultFromLoad();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left runAllDrawableDescriptorTests 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#stat... | runAllDrawableDescriptorTests() {
this.testDrawableDescriptorConstructor();
this.testDrawableDescriptorGetPixelMap();
this.testDrawableDescriptorLoadSync();
this.testDrawableDescriptorLoad();
this.testLoadedResultFromLoadSync();
this.testLoadedResultFromLoad();
} | https://gitcode.com/openharmony/arkui_ace_engine | dee1af5bced303290e93789ac7a8621684d7e1cf | gitcode |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/yearlySpendingChart.ets | arkts | getBarCount | 获取柱状图数量 | getBarCount(): number {
return this.chartMode === 'weekly' ? 7 : 12
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBarCount 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_... | getBarCount(): number {
return this.chartMode === 'weekly' ? 7 : 12
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 6e7f601b04570ff469bbff5e9f8d6a3c4a0c8c8d | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | nextUp | Replacement for the Math.nextUp(...) method that is only available in
HONEYCOMB and higher. Dat's some seeeeek sheeet.
@param d
@return | public static nextUp(d: number): number {
if (d == Number.MAX_VALUE)
return d;
else {
d += 0.0;
return d += 0.000000001;
}
} | 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 nextUp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right ... | public static nextUp(d: number): number {
if (d == Number.MAX_VALUE)
return d;
else {
d += 0.0;
return d += 0.000000001;
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6d6af4e1adcd71e482dfebc8cc42e1d37e4acd39 | gitee |
Tianpei-Shi/MusicDash | src/services/CloudDBService.ets | arkts | saveUserInfo | 保存或更新用户信息 | async saveUserInfo(userInfo: CloudDBZoneObject): Promise<boolean> {
try {
// 模拟保存用户信息
console.log('保存用户信息:', userInfo);
return true;
} catch (error) {
console.error('保存用户信息失败:', error);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveUserInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userInfo AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async saveUserInfo(userInfo: CloudDBZoneObject): Promise<boolean> {
try {
// 模拟保存用户信息
console.log('保存用户信息:', userInfo);
return true;
} catch (error) {
console.error('保存用户信息失败:', error);
return false;
}
} | https://github.com/Tianpei-Shi/MusicDash | d08201a359eb80c9c045c10b1c8085c3c5b0d7e2 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/CrashTracker.ets | arkts | recordCrash | Record a crash for the given scenario | recordCrash(scenario: string): void {
const count = (this.crashCounts.get(scenario) || 0) + 1;
this.crashCounts.set(scenario, count);
this.saveRegistry();
hilog.warn(DOMAIN, TAG, 'Crash recorded: %{public}s (count: %{public}d/%{public}d)',
scenario, count, this.threshold);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordCrash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scenario AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R... | recordCrash(scenario: string): void {
const count = (this.crashCounts.get(scenario) || 0) + 1;
this.crashCounts.set(scenario, count);
this.saveRegistry();
hilog.warn(DOMAIN, TAG, 'Crash recorded: %{public}s (count: %{public}d/%{public}d)',
scenario, count, this.threshold);
} | https://github.com/AGenUI/AGenUI | f8ecacec6d652ad8545d3dd5e57bb22dfa28c801 | github |
the-wwyang/kids-learning-app | src/main/ets/services/WrongQuestionService.ets | arkts | generateReviewPlan | 生成错题复习计划
@param records 错题记录列表
@param dailyGoal 每日复习目标数量
@returns 复习计划(按天分配) | static generateReviewPlan(
records: WrongQuestionRecord[],
dailyGoal: number = 5
): Map<string, WrongQuestionRecord[]> {
const plan = new Map<string, WrongQuestionRecord[]>();
const unmastered = records.filter(r => !r.isMastered);
// 按错误次数和时间排序
unmastered.sort((a, b) => {
if (b.errorC... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateReviewPlan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | static generateReviewPlan(
records: WrongQuestionRecord[],
dailyGoal: number = 5
): Map<string, WrongQuestionRecord[]> {
const plan = new Map<string, WrongQuestionRecord[]>();
const unmastered = records.filter(r => !r.isMastered);
// 按错误次数和时间排序
unmastered.sort((a, b) => {
if (b.errorC... | https://github.com/the-wwyang/kids-learning-app | a6f8e032afac870c5f699da12f3a54cec4bff253 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | $_invoke | Creates a new instance of a String from double
@param { double } value The value to be converted to a string.
@returns { string } A new String instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: double): string {
return new String(value);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double... | static $_invoke(value: double): string {
return new String(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 7b99e1221e6a2829ad69db281ffe6e0a3c29964c | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/CloudSyncService.ets | arkts | downloadFromCloud | 从云端下载数据 | private static async downloadFromCloud(options: SyncOptions): Promise<number> {
try {
console.log('[CloudSyncService] 开始从云端下载数据');
// 1. 从云端获取数据(模拟)
const downloadResult: CloudApiResponse = await CloudSyncService.mockCloudDownload(options.userId);
if (!downloadResult.success || !download... | 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 downloadFromCloud AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le... | private static async downloadFromCloud(options: SyncOptions): Promise<number> {
try {
console.log('[CloudSyncService] 开始从云端下载数据');
// 1. 从云端获取数据(模拟)
const downloadResult: CloudApiResponse = await CloudSyncService.mockCloudDownload(options.userId);
if (!downloadResult.success || !download... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fe168ee71f2d5fbcb999d3eae44d5394fdbfbbd1 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | length | property: The number of elements in the ArrayList. | get length(): int {
return this.buffer.length
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left length 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 int AST#identifier#Right... | get length(): int {
return this.buffer.length
} | https://gitcode.com/iop123123/arkts-static-skills | b5b59937724ec323dca3cb5a537583c0648a031f | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | some | Checks that at least one element of Int16Array satisfies the passed function
@param fn check function
@returns true if some element satisfies fn | public some(fn: (element: short) => boolean): boolean {
let newF: (element: short, index: int, array: Int16Array) => boolean =
(element: short, index: int, array: Int16Array): boolean => { return fn(element) }
return this.some(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public some(fn: (element: short) => boolean): boolean {
let newF: (element: short, index: int, array: Int16Array) => boolean =
(element: short, index: int, array: Int16Array): boolean => { return fn(element) }
return this.some(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 71316de80dee56c9c689312b67490adc9eb2a30a | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/pages/Index.ets | arkts | build | ========== 主界面 ========== | build() {
Stack() {
Column() {
// 悬浮窗/自由多窗顶部控制条避让
if (this.isCompact && this.safeAreaTop > 0) {
Row().height(this.safeAreaTop).width('100%')
}
// 自定义标题栏(仅在自由多窗/分屏模式下显示)
// 自定义标题栏(自由多窗模式下不显示窗口控制按钮,系统已提供)
if (this.showCustomTitleBar) {
Custo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#ERROR#Left AST#method_definitio... | build() {
Stack() {
Column() {
// 悬浮窗/自由多窗顶部控制条避让
if (this.isCompact && this.safeAreaTop > 0) {
Row().height(this.safeAreaTop).width('100%')
}
// 自定义标题栏(仅在自由多窗/分屏模式下显示)
// 自定义标题栏(自由多窗模式下不显示窗口控制按钮,系统已提供)
if (this.showCustomTitleBar) {
Custo... | https://github.com/AetheriumSimulator/qemu-hmos | f580cc2e4f5f4a5aa291f3bba68331218f8e46fc | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/http/WordPressApi.ets | arkts | uploadMedia | 上传媒体文件 | static async uploadMedia(site: WordPressSite, filePath: string, fileName: string,
mimeType: string): Promise<WPMediaResult> {
const result = new WPMediaResult()
// TODO: 实现多部分上传功能 - 将在第四阶段完成
result.message = '媒体上传功能将在后续版本中支持'
return result
} | 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 uploadMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left site AST#identifier#Right AST#:#Left : AST#:... | static async uploadMedia(site: WordPressSite, filePath: string, fileName: string,
mimeType: string): Promise<WPMediaResult> {
const result = new WPMediaResult()
// TODO: 实现多部分上传功能 - 将在第四阶段完成
result.message = '媒体上传功能将在后续版本中支持'
return result
} | https://github.com/encorexin/WordPressCMS | b78c50f445c02ef4fa2a2dbe252d14433ec8e991 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Float32Array using range [begin, end)
@param begin start index to be taken into slice
@param end last index to be taken into slice
@returns a new Float32Array with elements of current Float32Array[begin;end) where end index is excluded
@link https://developer.mozilla.org/en-US/docs/Web/JavaSc... | public slice(begin: number, end: number): Float32Array {
return this.slice(begin as int, end as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number, end: number): Float32Array {
return this.slice(begin as int, end as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | aa41cc96570bebfe9b2468efaf1fdf18bb972acd | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Console.ets | arkts | println | Prints a float to the console and puts newline
@param i value to print | public println(i: float): void {
this.print(i);
this.println();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left float AST#i... | public println(i: float): void {
this.print(i);
this.println();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 77ec25b786a5983256281abbc791d010269e6d35 | gitee |
openharmony-sig/arkui_composite_component | source/TreeView/TreeView.ets | arkts | findCurrentNodeIndex | nodeId to find index | function findCurrentNodeIndex(this, currentNodeId: number): number {
let thisIndex: number = 0;
this.listNodeDataSource.ListNode.forEach(function (value, index) {
if (value.getNodeCurrentNodeId() == currentNodeId) {
thisIndex = index;
}
})
return thisIndex;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left findCurrentNodeIndex AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#this#Left this AST#this#Right AST#required_parameter#Right AST#,#Left , AST#,#Rig... | function findCurrentNodeIndex(this, currentNodeId: number): number {
let thisIndex: number = 0;
this.listNodeDataSource.ListNode.forEach(function (value, index) {
if (value.getNodeCurrentNodeId() == currentNodeId) {
thisIndex = index;
}
})
return thisIndex;
} | https://gitee.com/openharmony-sig/arkui_composite_component.git | ab17ca5cddd66311847b24eb2d5aff312ef734e6 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates an Int16Array with respect to data, byteOffset and length.
@param buf data initializer
@param byteOffset byte offset from begin of the buf
@param length size of elements of type short in newly created Int16Array | public constructor(buf: Buffer, byteOffset: int, length: int) {
if (buf.getByteLength() % Int16Array.BYTES_PER_ELEMENT != 0) {
throw new RangeError("ArrayBuffer.byteLength should be multiple of 2 as Int16Array.BYTES_PER_ELEMENT")
}
if (byteOffset % Int16Array.BYTES_PER_ELEMENT !=... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe... | public constructor(buf: Buffer, byteOffset: int, length: int) {
if (buf.getByteLength() % Int16Array.BYTES_PER_ELEMENT != 0) {
throw new RangeError("ArrayBuffer.byteLength should be multiple of 2 as Int16Array.BYTES_PER_ELEMENT")
}
if (byteOffset % Int16Array.BYTES_PER_ELEMENT !=... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9748860bed5d765d419a02ac8cc4b885ebd000f5 | gitee |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/CirCleProgress.ets | arkts | build | 进度条的环形宽度 | build() {
Stack() {
Column() {
Progress({
value: this.progressCurrentValue,
total: this.progressTotalValue,
type: ProgressType.Ring
})
.value(this.progressCurrentValue)
.width(this.progressWidth)
.color(this.progressColor)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Stack() {
Column() {
Progress({
value: this.progressCurrentValue,
total: this.progressTotalValue,
type: ProgressType.Ring
})
.value(this.progressCurrentValue)
.width(this.progressWidth)
.color(this.progressColor)
... | https://gitee.com/openharmony-sig/ohos_easyui.git | 78a98629300511f2ac78e1f71d468542a4ad006d | gitee |
FadingLight9291117/vscode-arkts | examples/reference-test.ets | arkts | loadUserData | 定义:方法 loadUserData | async loadUserData(id: string): Promise<UserData> {
this.userId = id;
// 引用:UserData
const data: UserData = {
id: this.userId,
name: 'Test User',
age: 25
};
// 引用:loadUserData(递归调用示例)
if (id === 'refresh') {
return this.loadUserData('default');
}
this.use... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadUserData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left... | async loadUserData(id: string): Promise<UserData> {
this.userId = id;
// 引用:UserData
const data: UserData = {
id: this.userId,
name: 'Test User',
age: 25
};
// 引用:loadUserData(递归调用示例)
if (id === 'refresh') {
return this.loadUserData('default');
}
this.use... | https://github.com/FadingLight9291117/vscode-arkts | 7be0b95b77d9aa489e640c34dde1fbdd1f14727b | github |
dingzhilin1990/zhilinclaw | src/security/SandboxedExecutor.ets | arkts | runInSandbox | 在沙箱中运行代码 | private async runInSandbox(
code: Uint8Array | string,
input: any,
sandbox: any
): Promise<any> {
// 实际项目中应该:
// 1. 如果是 WASM 字节码,使用 OHOS 的 WASM 运行时加载
// 2. 如果是 JS 字符串,使用受限的 eval 或 QuickJS 引擎
// 这里仅作示例
if (typeof code === 'string') {
// 模拟执行
console.log('[SandboxedE... | 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 runInSandbox AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : A... | private async runInSandbox(
code: Uint8Array | string,
input: any,
sandbox: any
): Promise<any> {
// 实际项目中应该:
// 1. 如果是 WASM 字节码,使用 OHOS 的 WASM 运行时加载
// 2. 如果是 JS 字符串,使用受限的 eval 或 QuickJS 引擎
// 这里仅作示例
if (typeof code === 'string') {
// 模拟执行
console.log('[SandboxedE... | https://github.com/dingzhilin1990/zhilinclaw | bfc421385228a6e80c4984bc2daedc211fa5efdb | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | getSizeOfRotatedRectangleByDegrees | Returns a recyclable FSize instance.
Represents size of a rotated rectangle by degrees.
@param rectangleWidth
@param rectangleHeight
@param degrees
@return A Recyclable FSize instance | public static getSizeOfRotatedRectangleByDegrees(rectangleWidth: number,
rectangleHeight: number, degrees: number): FSize {
let radians: number = degrees * Utils.FDEG2RAD;
return Utils.getSizeOfRotatedRectangleByRadians(rectangleWidth, rectangleHeight, radian... | 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 getSizeOfRotatedRectangleByDegrees AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rectangleWidth AST#identifier#Right... | public static getSizeOfRotatedRectangleByDegrees(rectangleWidth: number,
rectangleHeight: number, degrees: number): FSize {
let radians: number = degrees * Utils.FDEG2RAD;
return Utils.getSizeOfRotatedRectangleByRadians(rectangleWidth, rectangleHeight, radian... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 36411bcd8b3c888d3e11e2bab9e604bcfa3c8efa | gitee |
Jack-TCN/richEditor | src/main/ets/controller/RichEditorController.ets | arkts | getParagraphRange | 获取选中范围和段落移动范围
@param selectRange 选中范围,为选中范围赋值
@returns 段落移动范围 | getParagraphRange(selectRange: Range): Range {
// 获取文本内容
let content: string = this.controller.getStyledString().getString();
// 获取光标所在位置
let start = this.controller.getSelection().start;
let end = this.controller.getSelection().end;
if (start === undefined || end === undefined){
select... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getParagraphRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selectRange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Range AST#identifier#Right AST#ERROR#Right AST#... | getParagraphRange(selectRange: Range): Range {
// 获取文本内容
let content: string = this.controller.getStyledString().getString();
// 获取光标所在位置
let start = this.controller.getSelection().start;
let end = this.controller.getSelection().end;
if (start === undefined || end === undefined){
select... | https://github.com/Jack-TCN/richEditor | 91edd38a0bff504aab7df1fa2fd9bbc2600c23b7 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | clearAllData | Clear all user data (for debugging/testing). | static async clearAllData(): Promise<void> {
if (!UserManager.dataPreferences) {
Logger.warn('UserManager', 'Preferences not initialized');
return;
}
try {
await UserManager.dataPreferences.clear();
await UserManager.dataPreferences.flush();
Logger.info('UserManager', 'All u... | 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 clearAllData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async clearAllData(): Promise<void> {
if (!UserManager.dataPreferences) {
Logger.warn('UserManager', 'Preferences not initialized');
return;
}
try {
await UserManager.dataPreferences.clear();
await UserManager.dataPreferences.flush();
Logger.info('UserManager', 'All u... | https://github.com/Harrisonls2004/WaterFlow | d851e2a65b37927dab1a9499410f7ef0cba7fe41 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets | arkts | popLast | Remove the last element in the TreeSet
@returns the value of the last element in the TreeSet | popLast(): T {
this.checkEmptyContainer();
const res = this.getLastValue();
this.remove(res);
return res;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left popLast 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 T AST#identifier#Right AST#ERROR#Right AST#statement_b... | popLast(): T {
this.checkEmptyContainer();
const res = this.getLastValue();
this.remove(res);
return res;
} | https://gitcode.com/iop123123/arkts-static-skills | fda3ad571a01b5bd9d8dd3b0c54f843cbfd99d0c | gitcode |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | registerNetworkListener | Subscribe to default-network changes so we can refresh the capture routes
when the underlying network (and thus its DNS) switches. Best effort:
failure to register just means no live refresh (a manual restart still
re-reads the network). | private registerNetworkListener(): void {
if (this.netListenerActive) {
return;
}
try {
this.netConn = connection.createNetConnection();
this.netConn.register((err: BusinessError) => {
if (err) {
this.appendDebugLog(`==/vpn_ext/net_register_error/ ${this.errorMessage(er... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerNetworkListener 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 v... | private registerNetworkListener(): void {
if (this.netListenerActive) {
return;
}
try {
this.netConn = connection.createNetConnection();
this.netConn.register((err: BusinessError) => {
if (err) {
this.appendDebugLog(`==/vpn_ext/net_register_error/ ${this.errorMessage(er... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L839-L864 | 18b7cc21960bdb626fcc99072f28e852f8c4d9da | github |
openharmony/applications_mms | entry/src/main/ets/utils/MmsPreferences.ets | arkts | getValueOfIntegrationSwitch | Obtains the value of the notification integration switch. | public getValueOfIntegrationSwitch(): string {
return <string> this.getValueFromMap(common.string.KEY_OF_INTEGRATION_SWITCH, common.bool.TRUE);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueOfIntegrationSwitch 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#Lef... | public getValueOfIntegrationSwitch(): string {
return <string> this.getValueFromMap(common.string.KEY_OF_INTEGRATION_SWITCH, common.bool.TRUE);
} | https://gitee.com/openharmony/applications_mms.git | 0cc9b50872633b6447c031e9884ecf021bc3545f | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets | arkts | $_set | Sets the element at the specified index.
@param index - The index of the element to set.
@param val - The value to set at the specified index. | public $_set(index: int, val: T): void {
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
this.buffer[index] = val;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_set 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 $_set(index: int, val: T): void {
this.checkEmptyContainer();
this.checkIndex(index, this.length - 1);
this.buffer[index] = val;
} | https://gitcode.com/iop123123/arkts-static-skills | 6993da56de9a5e8621af2244917310b8cb8a2ac7 | gitcode |
openharmony-tpc/ImageKnife | library/src/main/ets/utils/FileUtils.ets | arkts | writeDataSync | 向path写入数据
@param path 文件绝对路径
@param content 文件内容 | writeDataSync(path: string, content: ArrayBuffer | string): boolean {
try {
let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC).fd
fs.writeSync(fd, content)
fs.closeSync(fd)
return true
}
catch (err) {
LogUtil.error('FileUtils writeData... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeDataSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A... | writeDataSync(path: string, content: ArrayBuffer | string): boolean {
try {
let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC).fd
fs.writeSync(fd, content)
fs.closeSync(fd)
return true
}
catch (err) {
LogUtil.error('FileUtils writeData... | https://gitee.com/openharmony-tpc/ImageKnife.git | a2f8cf944c1ca1253bc7e250095152e9d99c6b3f | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadVibrationService.ets | arkts | handleRumble | ==================== 公开 API ====================
处理震动反馈 | handleRumble(controllerNumber: number, lowFreqMotor: number, highFreqMotor: number): void {
// Watchdog: 防止 USB 传输失败导致振动卡死 (3s 无新回调→强制停止)
if (this.rumbleWatchdogTimer !== -1) {
clearTimeout(this.rumbleWatchdogTimer);
this.rumbleWatchdogTimer = -1;
}
// 取消旧的 stop 确认定时器 (新命令到达, 无论零/非零都以最新为准)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRumble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left ... | handleRumble(controllerNumber: number, lowFreqMotor: number, highFreqMotor: number): void {
// Watchdog: 防止 USB 传输失败导致振动卡死 (3s 无新回调→强制停止)
if (this.rumbleWatchdogTimer !== -1) {
clearTimeout(this.rumbleWatchdogTimer);
this.rumbleWatchdogTimer = -1;
}
// 取消旧的 stop 确认定时器 (新命令到达, 无论零/非零都以最新为准)... | https://github.com/AlkaidLab/moonlight-harmony | ca9b63d67082afc15d85366b615417ab9a63d62f | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的家庭医生终端系统_韩乐/OpenHarmony_APP/Blood_pressure/entry/src/main/ets/MainAbility/pages/index.ets | arkts | build | In low-code mode, do not add anything to the build function, as it will be
overwritten by the content generated by the .visual file in the build phase. | build() {
Column() {
Column() {
Image($r('app.media.image1'))
.width('400vp')
.height('400vp')
.offset({ x: '0vp', y: '0vp' })
.flexShrink(0)
.backgroundImageSize(ImageSize.Auto)
.objectFit(ImageFit.Contain)
Text(`血 压 测 量 仪`)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Column() {
Image($r('app.media.image1'))
.width('400vp')
.height('400vp')
.offset({ x: '0vp', y: '0vp' })
.flexShrink(0)
.backgroundImageSize(ImageSize.Auto)
.objectFit(ImageFit.Contain)
Text(`血 压 测 量 仪`)
... | https://gitee.com/openharmony-sig/online_event.git | 15ec3fd819178f6d60ffdfe118833c7b7f5a3a8a | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Tuple.ets | arkts | length | Get the length of the tuple.
@returns { int } The length of the tuple.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get length(): int {
return 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left length 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 get length(): int {
return 0;
} | https://gitcode.com/iop123123/arkts-static-skills | 405ee25182cab4ba6c8065172586333de17f16dd | gitcode |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | deleteWord | Delete a word from the learned model | deleteWord(lang: string, word: string): void {
const m = this.ensure(lang);
const w = word.toLowerCase();
// Remove from unigram
m.uni.delete(w);
m.wordRank.delete(w);
m.lastUsed.delete(w);
// Remove from bigrams
m.bi.forEach((nextMap, _) => {
nextMap.delete(w);
});
//... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lang AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#... | deleteWord(lang: string, word: string): void {
const m = this.ensure(lang);
const w = word.toLowerCase();
// Remove from unigram
m.uni.delete(w);
m.wordRank.delete(w);
m.lastUsed.delete(w);
// Remove from bigrams
m.bi.forEach((nextMap, _) => {
nextMap.delete(w);
});
//... | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L396-L424 | 5e2bd9317d672916116cdb061a3999fd25ec9cbb | github |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | ErrorAnimation | 错误动画组件 | @Builder
function ErrorAnimation(
key: string,
progress: number
): void {
Column() {
Row() {
Image($r('sys.media.ohos_ic_public_fail'))
.width(24)
.height(24)
.fillColor(DesignTokens.Colors.ERROR)
.scale({
x: progress,
y: progress
})
... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left ErrorAnimation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#re... | @Builder
function ErrorAnimation(
key: string,
progress: number
): void {
Column() {
Row() {
Image($r('sys.media.ohos_ic_public_fail'))
.width(24)
.height(24)
.fillColor(DesignTokens.Colors.ERROR)
.scale({
x: progress,
y: progress
})
... | https://github.com/CLMC2025/Vignette | d761f42464e6598426b3a57027da9c7f61d62b7c | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | getUint16Array | Gets an array of unsigned shorts.
@param byteOffset The byte offset.
@param byteLength The byte length.
@returns The value. | getUint16Array(byteOffset: number, byteLength?: number): Uint16Array {
if (byteLength !== undefined) {
byteLength = Math.floor(byteLength / 2)
}
return this.dataView == null
? new Uint16Array(StringUtils.stringToArrayBuffer(""), byteOffset, byteLength)
: new Uint16Array(this.dataView.buf... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUint16Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AS... | getUint16Array(byteOffset: number, byteLength?: number): Uint16Array {
if (byteLength !== undefined) {
byteLength = Math.floor(byteLength / 2)
}
return this.dataView == null
? new Uint16Array(StringUtils.stringToArrayBuffer(""), byteOffset, byteLength)
: new Uint16Array(this.dataView.buf... | https://gitee.com/openharmony-sig/flutter_engine.git | 539a1d3dca29c89a59affefa22f46999541fb018 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an BigInt64Array with respect to buf.
@param { ArrayLike<Number> | ArrayBuffer } buf - data initializer
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLength = (buf as ArrayBuffer).getByteLength()
if (this.byteLength % BigInt64Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength should... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Lef... | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLength = (buf as ArrayBuffer).getByteLength()
if (this.byteLength % BigInt64Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength should... | https://gitcode.com/iop123123/arkts-static-skills | a7b3e0da231008df72df1c1f8de716d6871d0ac1 | gitcode |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/WeeklyBillListSectionComponent.ets | arkts | FlatListHeader | 构建按金额排序时使用的列表头部。 | private FlatListHeader() {
Row() {
Text('最近 7 天')
.fontSize(13)
.fontColor(this.themeState.fontSecondary)
Text(this.billSortModeText)
.fontSize(12)
.fontColor(this.themeState.brand)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left FlatListHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST... | private FlatListHeader() {
Row() {
Text('最近 7 天')
.fontSize(13)
.fontColor(this.themeState.fontSecondary)
Text(this.billSortModeText)
.fontSize(12)
.fontColor(this.themeState.brand)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left... | https://github.com/ZestBox-18/kitebook-frontend | ce372323a9f66f11e0a5d70760c193be4d00bf3a | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test50_original_index.ets | arkts | rotateLeft | --- Array rotation --- | function rotateLeft(arr: number[], k: number): number[] {
let n: number = arr.length;
let steps: number = k % n;
let result: number[] = [];
for (let i: number = 0; i < n; i++) {
let src: number = (i + steps) % n;
result.push(arr[src]);
}
return result;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left rotateLeft AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function rotateLeft(arr: number[], k: number): number[] {
let n: number = arr.length;
let steps: number = k % n;
let result: number[] = [];
for (let i: number = 0; i < n; i++) {
let src: number = (i + steps) % n;
result.push(arr[src]);
}
return result;
} | https://github.com/miaochiahao/ark-ghidra | 9d3af2e77c8d1ab1b0cc62dea710a14f153ad635 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets | arkts | executeExtremeRender | S7: Extreme render (simple placeholder since no fixture system yet) | private executeExtremeRender(): string | null {
const sm = new SurfaceManager(this.context);
sm.beginTextStream();
// Create a surface with many components
const components: string[] = [];
for (let i = 0; i < 50; i++) {
components.push(`{"id":"txt-${i}","component":"Text","text":"Item ${i} -... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeExtremeRender 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_express... | private executeExtremeRender(): string | null {
const sm = new SurfaceManager(this.context);
sm.beginTextStream();
// Create a surface with many components
const components: string[] = [];
for (let i = 0; i < 50; i++) {
components.push(`{"id":"txt-${i}","component":"Text","text":"Item ${i} -... | https://github.com/AGenUI/AGenUI | 94c3880959bd645b44efff06fb2361c1d8b3c7d7 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PodcastService.ets | arkts | addPodcastFromSearchResult | 从搜索结果中直接添加播客(不立刻抓取 RSS) | async addPodcastFromSearchResult(source: Podcast): Promise<Podcast> {
const podcast = new Podcast();
podcast.id = source.id || this.generateId();
podcast.title = source.title;
podcast.author = source.author;
podcast.description = source.description;
podcast.imageUrl = source.imageUrl;
podc... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addPodcastFromSearchResult AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left source AST#identifier#Right AST#type_annotation#Left... | async addPodcastFromSearchResult(source: Podcast): Promise<Podcast> {
const podcast = new Podcast();
podcast.id = source.id || this.generateId();
podcast.title = source.title;
podcast.author = source.author;
podcast.description = source.description;
podcast.imageUrl = source.imageUrl;
podc... | https://github.com/pangpang20/antennaPodHM | 2d7efb753b72be7ed2dbdfda0eede99d90ac9c4b | github |
openharmony-tpc/ohos_coap | libcoap/src/main/ets/components/mainpage/coapExchange.ets | arkts | response | 添加get请求处理器 | response(responseId: string, code:number, data: string): void {
return this.coapExchange.response(responseId, code, data);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left response AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left responseId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Ri... | response(responseId: string, code:number, data: string): void {
return this.coapExchange.response(responseId, code, data);
} | https://gitee.com/openharmony-tpc/ohos_coap.git | 6b4a790f25d1a6d7b2de97da500c0fc719947497 | gitee |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/component/preference/utils/PreferenceUtils.ets | arkts | loadPreference | 加载首选项并初始化
@param context 应用上下文
@returns void | loadPreference(context: Context): void {
try {
this.preferences = preferences.getPreferencesSync(context, { name: Const.PREFERENCES_FILE })
hilog.debug(this.domain, this.tag, `加载Preference ${Const.PREFERENCES_FILE} 成功!`)
} catch (error) {
let businessError = error as BusinessError
hilo... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadPreference AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Right AST#)#Lef... | loadPreference(context: Context): void {
try {
this.preferences = preferences.getPreferencesSync(context, { name: Const.PREFERENCES_FILE })
hilog.debug(this.domain, this.tag, `加载Preference ${Const.PREFERENCES_FILE} 成功!`)
} catch (error) {
let businessError = error as BusinessError
hilo... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 5a1cfa0254617d2a78e9e56ca64cbcc2667126d5 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | getEnabledSources | 获取启用的书源 | getEnabledSources(): NovelSourceInfo[] {
return this.getAllSources().filter(s => s.enabled);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getEnabledSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Ri... | getEnabledSources(): NovelSourceInfo[] {
return this.getAllSources().filter(s => s.enabled);
} | https://github.com/DaLongZhuaZi/manxia | eaf8e426823e7fd38894c8c57193f9be4f6ba9c0 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | push | Appends the bit element to the end of this bit vector.
@param { int } element - Element to be appended to this bit vector (0 means 0, else means 1).
@returns { boolean } The boolean type, returns true if the addition is successful, and returns false if it fails. | public push(element: int): boolean {
let index = this.computeElementIdAndBitId(this._length);
this.checkAndIncrement(index.elementId);
this.setBitUnsafe(this._length++, element);
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left push AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#i... | public push(element: int): boolean {
let index = this.computeElementIdAndBitId(this._length);
this.checkAndIncrement(index.elementId);
this.setBitUnsafe(this._length++, element);
return true;
} | https://gitcode.com/iop123123/arkts-static-skills | 53b64f1bff015c6ce52d53d3d6ed2ea904741b98 | gitcode |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/material_shadowReceiver.ets | arkts | toggleAnimSpeed | Playback direction of the reverse animation | toggleAnimSpeed(): void {
this.speed = -this.speed;
if (this.anim) {
this.anim.speed = this.speed;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleAnimSpeed 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_bl... | toggleAnimSpeed(): void {
this.speed = -this.speed;
if (this.anim) {
this.anim.speed = this.speed;
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 21ef2f4062328ed60875a3f487dddfed05f7a011 | gitcode |
HarmonyOS_Samples/guide-snippets | ArkGraphics2D/DisplaySoloist/entry/src/main/ets/pages/Index.ets | arkts | aboutToDisappear | [StartExclude display_soloist_create_xcomponent]
[Start display_soloist_disappear] | aboutToDisappear(): void {
// [StartExclude display_soloist_disappear]
Logger.info(TAG, 'aboutToDisappear');
// [EndExclude display_soloist_disappear]
if (this.xComponentContext1) {
this.xComponentContext1.unregister();
this.xComponentContext1.destroy();
}
if (this.xComponentContex... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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_b... | aboutToDisappear(): void {
// [StartExclude display_soloist_disappear]
Logger.info(TAG, 'aboutToDisappear');
// [EndExclude display_soloist_disappear]
if (this.xComponentContext1) {
this.xComponentContext1.unregister();
this.xComponentContext1.destroy();
}
if (this.xComponentContex... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | f5c41095fedcaa5952ec6a8da156965530a56172 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets | arkts | setDrawVerticalHighlightIndicator | Enables / disables the vertical highlight-indicator. If disabled, the indicator is not drawn.
@param enabled | public setDrawVerticalHighlightIndicator(enabled: boolean): void {
this.mDrawVerticalHighlightIndicator = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawVerticalHighlightIndicator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right... | public setDrawVerticalHighlightIndicator(enabled: boolean): void {
this.mDrawVerticalHighlightIndicator = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 18090d4d637c917f41763e48bfc5fce747d16da5 | gitee |
honjow/Next2V | feature/detail/src/main/ets/pages/TopicDetailPage.ets | arkts | maybeDismissResumeButton | Auto-dismiss the resume affordance once the user scrolls the saved floor into view on their own,
so it doesn't linger after it has effectively been satisfied. | private maybeDismissResumeButton(centerFloor: number): void {
if (!this.showResumeButton || this.resumeSavedFloor <= 0) {
return
}
if (centerFloor >= this.resumeSavedFloor - this.RESUME_BUTTON_FLOOR_PROXIMITY) {
this.showResumeButton = false
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left maybeDismissResumeButton AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left centerFloor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left n... | private maybeDismissResumeButton(centerFloor: number): void {
if (!this.showResumeButton || this.resumeSavedFloor <= 0) {
return
}
if (centerFloor >= this.resumeSavedFloor - this.RESUME_BUTTON_FLOOR_PROXIMITY) {
this.showResumeButton = false
}
} | https://github.com/honjow/Next2V | 85cbb70536dd0f2c822b9782f63fd70f53de6a69 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/Index.ets | arkts | navigateToScheduleDetail | 跳转到日程详情页面 | navigateToScheduleDetail(schedule: Schedule): void {
const params: ScheduleDetailParams = {
scheduleId: schedule.id
}
router.pushUrl({
url: AppConstants.PAGE_SCHEDULE_DETAIL,
params: params
}).catch((error: Error) => {
Logger.error(TAG, `Navigation failed: ${error.message}`)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateToScheduleDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left schedule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Schedule AST#identifier#Rig... | navigateToScheduleDetail(schedule: Schedule): void {
const params: ScheduleDetailParams = {
scheduleId: schedule.id
}
router.pushUrl({
url: AppConstants.PAGE_SCHEDULE_DETAIL,
params: params
}).catch((error: Error) => {
Logger.error(TAG, `Navigation failed: ${error.message}`)
... | https://gitcode.com/openharmony/codelabs | 2267d468f3c5c37a440fdc9fb1410047a064bfc1 | gitcode |
yuyu5333/Healthy_life | entry/src/main/ets/view/dialog/CustomDialogView.ets | arkts | <arrow> | (achievementLevel: number, isAchievement: number, task : TaskInfo)//原本只有一个achievementlevel | (res: AchievementInfo) => {
Logger.debug('CustomDialogView', 'SHOW_ACHIEVEMENT_DIALOG');
this.achievementLevel = res.showAchievement? res.achievementLevel:res.lastTaskInfo.taskID;
this.isAchievement = res.showAchievement? 1:0;
this.singleTask =res.lastTaskInfo;
this.achievementDialog... | AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left res AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left AchievementInfo AST#type_identifier#Right AST#typ... | (res: AchievementInfo) => {
Logger.debug('CustomDialogView', 'SHOW_ACHIEVEMENT_DIALOG');
this.achievementLevel = res.showAchievement? res.achievementLevel:res.lastTaskInfo.taskID;
this.isAchievement = res.showAchievement? 1:0;
this.singleTask =res.lastTaskInfo;
this.achievementDialog... | https://github.com/yuyu5333/Healthy_life | b151654205f223b31b6d21a5a7dd06e686c2257a | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/components/calendar/MonthView.ets | arkts | onMonthChange | 月份变化时重新构建日期 | onMonthChange(): void {
this.buildDates()
this.refreshKey++
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMonthChange 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... | onMonthChange(): void {
this.buildDates()
this.refreshKey++
} | https://gitcode.com/openharmony/codelabs | 2f546f0c01d72791cb7bbd7883a6e0eee0f878b1 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets | arkts | configure | 配置WebDAV | async configure(config: WebDAVConfig): Promise<void> {
this.config = config;
// 尝试初始化Native客户端
logger.info(TAG, `配置WebDAV: useNative=${this.useNative}, nativeAvailable=${isNativeModuleAvailable()}`);
if (this.useNative && isNativeModuleAvailable()) {
try {
const nativeConfig: WebDAV... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left configure AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left co... | async configure(config: WebDAVConfig): Promise<void> {
this.config = config;
// 尝试初始化Native客户端
logger.info(TAG, `配置WebDAV: useNative=${this.useNative}, nativeAvailable=${isNativeModuleAvailable()}`);
if (this.useNative && isNativeModuleAvailable()) {
try {
const nativeConfig: WebDAV... | https://github.com/DaLongZhuaZi/manxia | aea383a6061bd46ec8654835b164e230cbea48f2 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets | arkts | deleteContact | 删除联系人 | public async deleteContact(id: number): Promise<OperationResult> {
try {
const rdbStore = await this.ensureDBInitialized();
// 创建删除条件
const predicates = new relationalStore.RdbPredicates('contacts');
predicates.equalTo('id', id);
// 删除数据
const rowsDeleted = await rdbStore.del... | 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 deleteContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:... | public async deleteContact(id: number): Promise<OperationResult> {
try {
const rdbStore = await this.ensureDBInitialized();
// 创建删除条件
const predicates = new relationalStore.RdbPredicates('contacts');
predicates.equalTo('id', id);
// 删除数据
const rowsDeleted = await rdbStore.del... | https://gitcode.com/openharmony/codelabs | 3153cfd366973b24a3111fd2808c9f3ab0643826 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | reportNetworkFeedback | 上报客户端网络指标(每秒调用) | async reportNetworkFeedback(feedback: NetworkFeedback): Promise<AbrAction | null> {
try {
const baseUrl = await this.getHttpsBaseUrl();
const url = `${baseUrl}/api/abr/feedback`;
if (!this.certFilePath || !this.keyFilePath) return null;
const response = await HttpClient.postWithClientCer... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reportNetworkFeedback AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left feedback AST#identifier#Right AST#type_annotation#Left AS... | async reportNetworkFeedback(feedback: NetworkFeedback): Promise<AbrAction | null> {
try {
const baseUrl = await this.getHttpsBaseUrl();
const url = `${baseUrl}/api/abr/feedback`;
if (!this.certFilePath || !this.keyFilePath) return null;
const response = await HttpClient.postWithClientCer... | https://github.com/AlkaidLab/moonlight-harmony | dfd38a7349f9c0d1df352a29ed47fe86415e5581 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/AuthenticationHandler.ets | arkts | isTokenExpired | 检查令牌是否过期 | async isTokenExpired(token?: string): Promise<boolean> {
try {
const tokenToCheck = token || await this.getStoredToken();
if (!tokenToCheck) {
return true;
}
// 只有JWT类型才检查过期
if (this.config.type === 'jwt') {
const leeway = this.config.tokenLeeway || 10;
retur... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isTokenExpired AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left token AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_ann... | async isTokenExpired(token?: string): Promise<boolean> {
try {
const tokenToCheck = token || await this.getStoredToken();
if (!tokenToCheck) {
return true;
}
// 只有JWT类型才检查过期
if (this.config.type === 'jwt') {
const leeway = this.config.tokenLeeway || 10;
retur... | https://github.com/DaLongZhuaZi/manxia | 733a7fbb8da5d110b4076b6273b89c6d45425553 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/pages/Index.ets | arkts | createBookmark | Create new bookmark | createBookmark(): void {
router.pushUrl({
url: 'pages/BookmarkPage',
params: {
mode: 'create'
}
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createBookmark 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... | createBookmark(): void {
router.pushUrl({
url: 'pages/BookmarkPage',
params: {
mode: 'create'
}
});
} | https://github.com/tangwengang-del/freerdp-harmonyos | 87cf5bbbcb337483acb411d3e710e4a737e3d0e0 | github |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/utils/Utils.ets | arkts | convertDpToPixel | This method converts dp unit to equivalent pixels, depending on device
density. NEEDS UTILS TO BE INITIALIZED BEFORE USAGE.
@param dp A value in dp (density independent pixels) unit. Which we need
to convert into pixels
@return A float value to represent px equivalent to dp depending on
device density | public static convertDpToPixel(dp: number): number{
//return dp * this.scaledDensity;
return vp2px(dp);
} | 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 convertDpToPixel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dp AST#identifier#Right AST#:#Left : A... | public static convertDpToPixel(dp: number): number{
//return dp * this.scaledDensity;
return vp2px(dp);
} | https://gitee.com/openharmony-sig/smartperf.git | b149f869ef90da47e6b5502f860294a6d4603c99 | gitee |
OHPG/FinVideo | entry/src/main/ets/player/VersionSelectStrategy.ets | arkts | resolutionTier | ─── 分辨率档位 ──────────────────────────────────────────────────────────────
将视频分辨率映射到档位:4K=4 1080p=3 720p=2 480p=1 其他=0,取宽高较大值判断 | private static resolutionTier(width?: number, height?: number): number {
const size = Math.max(width ?? 0, height ?? 0)
if (size >= 3840) return 4
if (size >= 1920) return 3
if (size >= 1280) return 2
if (size >= 854) return 1
return 0
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left resolutionTier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#?#Left... | private static resolutionTier(width?: number, height?: number): number {
const size = Math.max(width ?? 0, height ?? 0)
if (size >= 3840) return 4
if (size >= 1920) return 3
if (size >= 1280) return 2
if (size >= 854) return 1
return 0
} | https://github.com/OHPG/FinVideo | cbe8656c48e62a8be7f3399d94d78f3d4d89f693 | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets | arkts | generateEmergencyResponse | 生成紧急响应 | private static generateEmergencyResponse(): ConsultationResult {
return {
possibleCauses: [{ cause: '需要紧急医疗关注', probability: 100 }],
recommendations: [
'🚨 立即拨打急救电话 120',
'🏥 前往最近的急诊科',
'⛔ 不要驾车,让他人送医或叫救护车',
'📱 告知家人您的位置'
],
urgencyLevel: 'emergency',
s... | 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 generateEmergencyResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express... | private static generateEmergencyResponse(): ConsultationResult {
return {
possibleCauses: [{ cause: '需要紧急医疗关注', probability: 100 }],
recommendations: [
'🚨 立即拨打急救电话 120',
'🏥 前往最近的急诊科',
'⛔ 不要驾车,让他人送医或叫救护车',
'📱 告知家人您的位置'
],
urgencyLevel: 'emergency',
s... | https://github.com/LJ666-ui/harmony-health-care | b8f2b8de067f44a8849a9b0750aef63f1921e470 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getElementsByCSS | 通过CSS选择器获取元素列表
支持Legado的@分隔符语法,例如 .container ul@li
支持&&操作符(与操作,合并多个选择器结果)
优先使用HTML解析器进行DOM解析,回退到字符串解析 | private getElementsByCSS(selector: string): string[] {
// 先处理 && 操作符(与操作,合并多个选择器的结果)
if (selector.includes('&&')) {
const andParts = selector.split('&&');
const allResults: string[] = [];
for (const part of andParts) {
const trimmedPart = part.trim();
if (trimmedPart) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByCSS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private getElementsByCSS(selector: string): string[] {
// 先处理 && 操作符(与操作,合并多个选择器的结果)
if (selector.includes('&&')) {
const andParts = selector.split('&&');
const allResults: string[] = [];
for (const part of andParts) {
const trimmedPart = part.trim();
if (trimmedPart) {
... | https://github.com/DaLongZhuaZi/manxia | f5add50697de6b3d26c37d318a6c535b50e44f19 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | toggleFavorite | 切换收藏状态
@param id item id
@param favorite 是否收藏 | public toggleFavorite(id: string, favorite: boolean): Promise<void> {
return this.requireApi().toggleFavorite(id, favorite)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toggleFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | public toggleFavorite(id: string, favorite: boolean): Promise<void> {
return this.requireApi().toggleFavorite(id, favorite)
} | https://github.com/OHPG/FinMusic | 38a27c3ede3f6c5b61e45c26673eee5907cc33e9 | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/AccountManager.ets | arkts | updateAccountBalanceByName | 按名称增量更新账户余额,供账单增删改时复用。 | static async updateAccountBalanceByName(name: string, delta: number): Promise<boolean> {
if (delta === 0) {
return true;
}
const account: AccountBean | null = await AccountManager.getAccountByName(name);
if (account === null) {
Clog.warn(TAG, `账户不存在,跳过余额更新: ${name}`);
return false;
... | 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 updateAccountBalanceByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST... | static async updateAccountBalanceByName(name: string, delta: number): Promise<boolean> {
if (delta === 0) {
return true;
}
const account: AccountBean | null = await AccountManager.getAccountByName(name);
if (account === null) {
Clog.warn(TAG, `账户不存在,跳过余额更新: ${name}`);
return false;
... | https://github.com/ZestBox-18/kitebook-frontend | 0eec54488bcd677c2279d66eba10ec572fb99b0d | github |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/pages/Index.ets | arkts | aboutToAppear | 1. 页面初始化生命周期 | aboutToAppear() {
console.info("Debug: 应用启动 (aboutToAppear)");
this.checkNetworkAndLocate();
} | 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() {
console.info("Debug: 应用启动 (aboutToAppear)");
this.checkNetworkAndLocate();
} | https://github.com/OnceWeWere/Weather_HarmonyOS | 983b2bc309e8f0b6d838abd910d93c36f62bfddd | github |
fbinba3955/Flymby | common/src/main/ets/utils/BrightnessUtil.ets | arkts | setWindowKeepScreenState | 设置窗口保持屏幕常亮状态
@param keepScreenOn 是否保持屏幕常亮 | public static async setWindowKeepScreenState(keepScreenOn: boolean): Promise<void> {
try {
if (BrightnessUtil.currentWindow) {
await BrightnessUtil.currentWindow.setWindowKeepScreenOn(keepScreenOn);
LogUtil.info(`BrightnessUtil 设置屏幕常亮状态: ${keepScreenOn}`);
}
} catch (err) {
c... | 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 setWindowKeepScreenState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keepScre... | public static async setWindowKeepScreenState(keepScreenOn: boolean): Promise<void> {
try {
if (BrightnessUtil.currentWindow) {
await BrightnessUtil.currentWindow.setWindowKeepScreenOn(keepScreenOn);
LogUtil.info(`BrightnessUtil 设置屏幕常亮状态: ${keepScreenOn}`);
}
} catch (err) {
c... | https://github.com/fbinba3955/Flymby | 05f4a5ff7ae663d38909150bdafe22397fa754d5 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | attachLazyRelations | 为查询结果设置延迟加载的关联处理器
@param entities 主实体数据数组 | private attachLazyRelations(entities: Array<EntityData>): void {
this.relationSupport.attachLazyRelations(entities)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left attachLazyRelations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entities AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | private attachLazyRelations(entities: Array<EntityData>): void {
this.relationSupport.attachLazyRelations(entities)
} | https://github.com/offlinecat-dev/OCNetORM | 0bcff62ed2b4c8ce8e23367bcb2c9b2f2fd29563 | github |
apap6628114/nga_oh | entry/src/main/ets/store/BaseStore.ets | arkts | uidGuard | 写入队列前检查 uid 是否仍有效(auth 未注入时返回 true 不拦截) | protected uidGuard(): boolean {
return this.auth ? !!this.auth.uid : true
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left uidGuard AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST... | protected uidGuard(): boolean {
return this.auth ? !!this.auth.uid : true
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/BaseStore.ets#L57-L59 | 3d90626b26dd7b8e924af7fa7bca72f7659fba7c | github |
SuperBird007/HarmonyApp_beichengyu | entry/src/main/ets/util/PreferencesUtil.ets | arkts | init | 初始化preferences实例
@context 应用上下文 | async init(context: Context) {
try {
this.pref = await preferences.getPreferences(context, this.sp_name)
} catch (err) {
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async init(context: Context) {
try {
this.pref = await preferences.getPreferences(context, this.sp_name)
} catch (err) {
}
} | https://github.com/SuperBird007/HarmonyApp_beichengyu | 74c2da825b6b1c6189273c16b07e5642e510db8e | github |
openharmony/applications_call | entry/src/main/ets/model/NotificationManager.ets | arkts | cancelNotification | Cancel notice | cancelNotification() {
LogUtils.i(TAG, 'cancelNotification')
notification.cancel(ID).then((res) => {
LogUtils.i(TAG, 'notify.cancel res data : %s' + JSON.stringify(res))
}).catch((err) => {
LogUtils.i(TAG, 'notify.cancel err data : %s' + JSON.stringify(err))
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left cancelNotification 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... | cancelNotification() {
LogUtils.i(TAG, 'cancelNotification')
notification.cancel(ID).then((res) => {
LogUtils.i(TAG, 'notify.cancel res data : %s' + JSON.stringify(res))
}).catch((err) => {
LogUtils.i(TAG, 'notify.cancel err data : %s' + JSON.stringify(err))
});
} | https://gitee.com/openharmony/applications_call.git | 60392aa9039eb5ed05d79f2a8e3c57c74a5f35c5 | gitee |
Yebingiscn/SweetVideo | entry/src/main/ets/component/PlayerComponent/AudioTrackComponent.ets | arkts | getTrackIndex | 获取轨道索引 | getTrackIndex(item: TrackType): number {
if (this.isAudioTrack(item)) {
return (item as AudioTrack).index
} else if (this.isMpvAudioTrack(item)) {
return (item as MpvAudioTrack).id
}
return 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTrackIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TrackType AST#identifier#Right AST#)#Left ... | getTrackIndex(item: TrackType): number {
if (this.isAudioTrack(item)) {
return (item as AudioTrack).index
} else if (this.isMpvAudioTrack(item)) {
return (item as MpvAudioTrack).id
}
return 0
} | https://github.com/Yebingiscn/SweetVideo | c4b29802c74bb4d3d14439b6bf15f7a7a704a85d | github |
HarmonyOS_Samples/BestPracticeSnippets | AppDataSecurity/entry/src/main/ets/pages/Index.ets | arkts | GetAesDecryptProperties | [End get_aes_encrypt_properties]
[Start get_aes_decrypt_properties] | function GetAesDecryptProperties(): Array<huks.HuksParam> {
let properties: Array<huks.HuksParam> = [{
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES
}, {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
}, {
tag: huks.HuksTag.HUKS_T... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left GetAesDecryptProperties 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#gen... | function GetAesDecryptProperties(): Array<huks.HuksParam> {
let properties: Array<huks.HuksParam> = [{
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES
}, {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
}, {
tag: huks.HuksTag.HUKS_T... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 0ef53b3bc52b3f04372f53769b1e4d118c03feb2 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets | arkts | setRetentionDays | 设置数据保留天数 | public async setRetentionDays(days: number): Promise<void> {
if (RETENTION_DAYS_OPTIONS.includes(days)) {
this.settings.retentionDays = days;
await this.saveSettings();
logger.info(TAG, `数据保留天数已设置为: ${days}天`);
} else {
logger.warn(TAG, `无效的保留天数: ${days}`);
}
} | 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 setRetentionDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left days AST#identifier#Right AST#:#Left : ... | public async setRetentionDays(days: number): Promise<void> {
if (RETENTION_DAYS_OPTIONS.includes(days)) {
this.settings.retentionDays = days;
await this.saveSettings();
logger.info(TAG, `数据保留天数已设置为: ${days}天`);
} else {
logger.warn(TAG, `无效的保留天数: ${days}`);
}
} | https://github.com/DaLongZhuaZi/manxia | c472a6ae11be0bcfe09de74059bff12848945c6b | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/service/RepositoryService.ets | arkts | getRepositoryCommits | 获取仓库 commits —— 对齐 Compose RepositoryRepository.getRepositoryCommits:
默认分支第一页先读取本地 DB,再请求网络刷新并写回 DB。 | async getRepositoryCommits(fullName: string,
page: number): Promise<RepositoryServiceResult<RepositoryCommitItem[]>> {
const owner: RepoOwnerName = RepoOwnerName.parse(fullName);
if (owner.owner.length === 0 || owner.name.length === 0) {
return new RepositoryServiceResult<Re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRepositoryCommits AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fullName AST#identifier#Right AST#type_annotation#Left AST... | async getRepositoryCommits(fullName: string,
page: number): Promise<RepositoryServiceResult<RepositoryCommitItem[]>> {
const owner: RepoOwnerName = RepoOwnerName.parse(fullName);
if (owner.owner.length === 0 || owner.name.length === 0) {
return new RepositoryServiceResult<Re... | https://github.com/CarGuo/GSYGithubAppOH | b1746098f16d14679e4b68b02a747960642e72e9 | github |
OHPG/FinMusic | entry/src/main/ets/prefer/AppPrefer.ets | arkts | isDnsCacheEnabled | ─── DNS 缓存相关 ────────────────────────────────────────────────────────── | public isDnsCacheEnabled(): boolean {
return this.preference.getSync(AppPrefer.KEY_DNS_CACHE_ENABLED, true) as boolean
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDnsCacheEnabled 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... | public isDnsCacheEnabled(): boolean {
return this.preference.getSync(AppPrefer.KEY_DNS_CACHE_ENABLED, true) as boolean
} | https://github.com/OHPG/FinMusic | 8ae06d77bb625220c5c5d4008c820a0900eb1b9a | github |
arkui-x/samples | CodeLab/ArkTSComponentCollection/entry/src/main/ets/pages/universal/events/areaChangeEventSample/AreaChangeEventSample.ets | arkts | onPageShow | 1 为正方向,-1 为负方向 | onPageShow() {
this.startMotionControlling()
} | 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() {
this.startMotionControlling()
} | https://gitcode.com/arkui-x/samples | 0f683eb6cfc8b68b9f7aa889c06cf258d17cabf5 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readUIntLE | Reads an unsigned integer from the buffer at the specified offset using little-endian format
@param {int} offset - Number of bytes to skip before reading
@param {int} byteLength - Number of bytes to read (maximum 6)
@returns {long} The read value
@throws {Error} If byteLength is greater than 6 | public readUIntLE(offset: int, byteLength: int): long {
let lengthOffset: int = this.length - byteLength;
Buffer.checkOffsetConstraint(offset, lengthOffset);
Buffer.checkByteLengthConstraint(byteLength);
return this.readBytes(this.getDataView(), offset, byteLength... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readUIntLE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public readUIntLE(offset: int, byteLength: int): long {
let lengthOffset: int = this.length - byteLength;
Buffer.checkOffsetConstraint(offset, lengthOffset);
Buffer.checkByteLengthConstraint(byteLength);
return this.readBytes(this.getDataView(), offset, byteLength... | https://gitcode.com/iop123123/arkts-static-skills | 4394e8a86577a623587a7fa01210f88c5e116674 | gitcode |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/pages/ArticleEditorPage.ets | arkts | handleStopGenerate | 停止 AI 生成 | handleStopGenerate(): void {
if (this.streamRequest) {
AIStreamClient.abortStream(this.streamRequest)
}
this.activeGenerationId += 1
this.cleanupGenerationState(0)
UiFeedback.showToast({ message: '已停止生成' })
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleStopGenerate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_express... | handleStopGenerate(): void {
if (this.streamRequest) {
AIStreamClient.abortStream(this.streamRequest)
}
this.activeGenerationId += 1
this.cleanupGenerationState(0)
UiFeedback.showToast({ message: '已停止生成' })
} | https://github.com/encorexin/WordPressCMS | 55147300afbf03e1cdd3719f8e69253cca293445 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | toWellFormed | The toWellFormed() method of String values returns a string where all lone surrogates of
this string are replaced with the Unicode replacement character U+FFFD. | public toWellFormed(): String {
return this.normalize()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toWellFormed 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 String AS... | public toWellFormed(): String {
return this.normalize()
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b97827c186887eb9b10ca81d38c5b65806573011 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets | arkts | initializeCloudBackup | 初始化云端备份(创建索引文件) | async initializeCloudBackup(): Promise<void> {
if (!this.client && !this.nativeClient) {
throw new Error('WebDAV未配置');
}
logger.info(TAG, '初始化云端备份索引');
const index: BackupIndex = {
version: 1,
lastUpdated: Date.now(),
backups: []
};
await this.saveBackupIndex... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initializeCloudBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotatio... | async initializeCloudBackup(): Promise<void> {
if (!this.client && !this.nativeClient) {
throw new Error('WebDAV未配置');
}
logger.info(TAG, '初始化云端备份索引');
const index: BackupIndex = {
version: 1,
lastUpdated: Date.now(),
backups: []
};
await this.saveBackupIndex... | https://github.com/DaLongZhuaZi/manxia | 1540d89b21d019af860c5c7a1519b683709bc7df | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | initializeGameControllerKit | 初始化 Game Controller Kit (API 21+)
优先使用系统级 API 提供统一的 USB/蓝牙手柄支持 | private initializeGameControllerKit(): void {
if (!gameControllerService.isAvailable()) {
console.info('[GAMEPAD] Game Controller Kit 不可用,使用传统输入方案');
this.fallbackToLegacyInput();
return;
}
console.info('[GAMEPAD] Game Controller Kit 可用,初始化中...');
if (!gameControllerService... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeGameControllerKit 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#R... | private initializeGameControllerKit(): void {
if (!gameControllerService.isAvailable()) {
console.info('[GAMEPAD] Game Controller Kit 不可用,使用传统输入方案');
this.fallbackToLegacyInput();
return;
}
console.info('[GAMEPAD] Game Controller Kit 可用,初始化中...');
if (!gameControllerService... | https://github.com/AlkaidLab/moonlight-harmony | 66512e1c627c1782710f2228ca388dd681f51991 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | animationEnabled | 是否启用动画 | public get animationEnabled(): boolean {
return this.currentProfile.effects.enableAnimation;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left animationEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public get animationEnabled(): boolean {
return this.currentProfile.effects.enableAnimation;
} | https://github.com/DaLongZhuaZi/manxia | f2a55a7d67947e1c88445a2e67d0bf5d9354a88b | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/utils/MathUtils.ets | arkts | getRandomInt | 生成指定范围内的随机整数
@param min
@param max | static getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1) + min);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRandomInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | static getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1) + min);
} | https://gitcode.com/arkui-x/samples | 91a09ae6ef98f6bb40a970555061ba4f09aec019 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | reset | Resets the byte offset. | reset(): void {
this.mByteOffset = this.dataView?.byteOffset ?? 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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#Left A... | reset(): void {
this.mByteOffset = this.dataView?.byteOffset ?? 0
} | https://gitee.com/openharmony-sig/flutter_engine.git | 082fbefa02c3c89e6a4e64b33520e3e30d797948 | gitee |
YANGZX22/Voot | entry/src/main/ets/pages/PolishPage.ets | arkts | hasModification | 比较两个句子,判断是否有修改 | hasModification(original: string, polished: string): boolean {
return original.trim() !== polished.trim();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasModification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left original AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST... | hasModification(original: string, polished: string): boolean {
return original.trim() !== polished.trim();
} | https://github.com/YANGZX22/Voot | 06f9a225c149e8e464799e330d21b77f09f3eb4c | github |
heeh02/superconnect | harmony/entry/src/main/ets/input/GestureController.ets | arkts | centroid | Centroid of the tracked ids that are still present; falls back to last centroid. | private centroid(ts: TouchObject[]): Pt {
let sx: number = 0;
let sy: number = 0;
let n: number = 0;
for (const t of ts) {
if (this.ids.indexOf(t.id) >= 0) { sx += t.x; sy += t.y; n += 1; }
}
return n > 0 ? { x: sx / n, y: sy / n } : this.twoLast;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left centroid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#L... | private centroid(ts: TouchObject[]): Pt {
let sx: number = 0;
let sy: number = 0;
let n: number = 0;
for (const t of ts) {
if (this.ids.indexOf(t.id) >= 0) { sx += t.x; sy += t.y; n += 1; }
}
return n > 0 ? { x: sx / n, y: sy / n } : this.twoLast;
} | https://github.com/heeh02/superconnect | 545c7edbc17740754ce134cf1e69d8f535a48492 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/XmlUtil.ets | arkts | hasTag | 检查 XML 中是否包含指定标签
@param xml XML 字符串
@param tag 标签名
@returns 是否存在该标签 | static hasTag(xml: string, tag: string): boolean {
const regex = new RegExp(`<${tag}>.*?</${tag}>`, 's');
return regex.test(xml);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xml AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | static hasTag(xml: string, tag: string): boolean {
const regex = new RegExp(`<${tag}>.*?</${tag}>`, 's');
return regex.test(xml);
} | https://github.com/AlkaidLab/moonlight-harmony | 9000b17646b9ff7c7090a79c2641da60d7f0630e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | IncWriters | Increments the writer count in the state.
@param { long } state Current lock state
@returns { long } Updated state value with incremented writer count
@throws { RangeError } If the writer count would overflow the maximum allowed value
@syscap SystemCapability.Utils.Lang | public static IncWriters(state: long): long {
if ((state & State.WRITERS_MASK) == State.WRITERS_MASK) {
throw new RangeError("AsyncReadWriteLock:: Too many writers");
}
return state + State.ONE_WRITER;
} | 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 IncWriters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public static IncWriters(state: long): long {
if ((state & State.WRITERS_MASK) == State.WRITERS_MASK) {
throw new RangeError("AsyncReadWriteLock:: Too many writers");
}
return state + State.ONE_WRITER;
} | https://gitcode.com/iop123123/arkts-static-skills | a0aba20c1ccc24d26e6ca50e174d85ca1a2d51de | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/FullscreenController.ets | arkts | disableFullscreen | 禁用全屏模式
@returns Promise<boolean> 是否成功禁用全屏 | public async disableFullscreen(): Promise<boolean> {
if (!this.windowClass) {
console.error(`${TAG} Window not initialized, cannot disable fullscreen`);
return false;
}
try {
// 恢复正常窗口模式
await this.windowClass.setWindowLayoutFullScreen(false);
console.info(`${TAG} setWindowL... | 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 disableFullscreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public async disableFullscreen(): Promise<boolean> {
if (!this.windowClass) {
console.error(`${TAG} Window not initialized, cannot disable fullscreen`);
return false;
}
try {
// 恢复正常窗口模式
await this.windowClass.setWindowLayoutFullScreen(false);
console.info(`${TAG} setWindowL... | https://github.com/richshaw2015/nds | 6272602badc572d642f4160cf44962b5a54b5a80 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | loadPersistedData | 加载持久化的数据 | private async loadPersistedData(): Promise<void> {
if (!this.dataPreferences) return;
try {
// 加载登录状态
const statusJson = await this.dataPreferences.get(LOGIN_STATUS_STORAGE_KEY, '') as string;
logger.debug(TAG, `加载持久化数据: statusJson长度=${statusJson ? statusJson.length : 0}`);
if (status... | 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 loadPersistedData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async loadPersistedData(): Promise<void> {
if (!this.dataPreferences) return;
try {
// 加载登录状态
const statusJson = await this.dataPreferences.get(LOGIN_STATUS_STORAGE_KEY, '') as string;
logger.debug(TAG, `加载持久化数据: statusJson长度=${statusJson ? statusJson.length : 0}`);
if (status... | https://github.com/DaLongZhuaZi/manxia | 1754f8389a8271afadec739782695a1b15a98fc6 | github |
erosTeam/NextE | feature/gallery/src/main/ets/components/GalleryTagsCard.ets | arkts | <arrow> | version in the key subscribes the card + re-colors chips on a late My Tags load. | (t: SimpleTag) =>
`${this.tagSig.version}:${tg.namespace}:${t.text}:${t.translat}:${t.vote}`, | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left t AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left SimpleTag AST#type_identifier#Right AST#type_annotation#Right AST#... | (t: SimpleTag) =>
`${this.tagSig.version}:${tg.namespace}:${t.text}:${t.translat}:${t.vote}`, | https://github.com/erosTeam/NextE | c2092562f1d66f1f7f1adfe1edda7407719d9ca5 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/Utils.ets | arkts | decodeQueryStringForLog | URL-decode the value side of each `k=v` pair in a query-string body so
debug logs are human-readable. Keys are kept as-is (they're ASCII
identifiers); values get `decodeURIComponent`-ed individually so a
single malformed pair doesn't ruin the whole line. On decode failure
the original encoded value is preserved unchang... | public static decodeQueryStringForLog(data: string): string {
if (data.length === 0) return data;
const parts: string[] = data.split('&');
const out: string[] = [];
for (let i = 0; i < parts.length; i++) {
const eq: number = parts[i].indexOf('=');
if (eq === -1) { out.push(parts[i]); conti... | 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 decodeQueryStringForLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:... | public static decodeQueryStringForLog(data: string): string {
if (data.length === 0) return data;
const parts: string[] = data.split('&');
const out: string[] = [];
for (let i = 0; i < parts.length; i++) {
const eq: number = parts[i].indexOf('=');
if (eq === -1) { out.push(parts[i]); conti... | https://github.com/Countly/countly-sdk-hos | f03f8d8a659554d1b97ca1bf42dd6165b85dba76 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.