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 |
|---|---|---|---|---|---|---|---|---|---|---|
xblLab/HarmonyProjectTemplate | commons/lib_common/src/main/ets/utils/TelephoneUtils.ets | arkts | callPhone | 拨打电话
@param tel | public static callPhone(tel: string) {
if (canIUse('SystemCapability.Applications.Contacts')) {
call.makeCall(tel, (err: BusinessError) => {
if (!err) {
Logger.info(TAG, 'make call success.');
} else {
Logger.info(TAG, 'make call fail, err is:' + JSON.stringify(err));
... | 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 callPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tel AST#identifier#Right AST#:#Left : AST#:#R... | public static callPhone(tel: string) {
if (canIUse('SystemCapability.Applications.Contacts')) {
call.makeCall(tel, (err: BusinessError) => {
if (!err) {
Logger.info(TAG, 'make call success.');
} else {
Logger.info(TAG, 'make call fail, err is:' + JSON.stringify(err));
... | https://github.com/xblLab/HarmonyProjectTemplate | b6140b95dce17524818941285cf4003380f64425 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | loadCartData | 加载购物车数据
@returns {Promise<void>} Promise<void> | async loadCartData(): Promise<void> {
this.isLoading = true;
try {
this.cartList = await this.cartRepository.getAllCarts();
} finally {
this.isLoading = false;
}
} | 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 loadCartData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#... | async loadCartData(): Promise<void> {
this.isLoading = true;
try {
this.cartList = await this.cartRepository.getAllCarts();
} finally {
this.isLoading = false;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | d4f20d53a727f97a49f9b187160b566413ecfd9c | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitRepeatedUint64 | 访问 repeated uint64 字段 | visitRepeatedUint64(value: bigint[], fieldNumber: number): void {
for (const item of value) {
this.visitUint64(item, fieldNumber)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedUint64 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#subscript_expression#Left AST#identifier#Left bigin... | visitRepeatedUint64(value: bigint[], fieldNumber: number): void {
for (const item of value) {
this.visitUint64(item, fieldNumber)
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 22a2bdf126999b1c793e7e1caae95966b69b3480 | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/components/select/picker/components/CalendarStylePicker.ets | arkts | formatDateYYYYMMDD | Formats a Date object into a "YYYY/MM/DD" string.
Placed outside the component to follow the principle of minimal scope.
@param {Date} date - The Date object to format
@returns {string} Formatted date string (e.g., "2024/03/14") | function formatDateYYYYMMDD(date: Date): string {
const year = date.getFullYear();
// Month is 0-indexed, add 1 and pad with leading zero if necessary
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatDateYYYYMMDD AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left date AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function formatDateYYYYMMDD(date: Date): string {
const year = date.getFullYear();
// Month is 0-indexed, add 1 and pad with leading zero if necessary
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`;
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 091372799ba620673713b89e04f234c10ff23cc4 | gitcode |
fbinba3955/Flymby | common/src/main/ets/utils/BrightnessUtil.ets | arkts | setBrightness | 设置窗口亮度
@param brightness 亮度值 0.01-1.0
@param source 设置来源 | public static async setBrightness(brightness: number | string, source: string): Promise<void> {
try {
let brightnessValue: number;
if (typeof brightness === 'string') {
// 如果传入的是页面名称,从映射中获取亮度
brightnessValue = BrightnessUtil.brightnessMap.get(brightness) || BrightnessUtil.DEFAULT_BRIG... | 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 setBrightness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifi... | public static async setBrightness(brightness: number | string, source: string): Promise<void> {
try {
let brightnessValue: number;
if (typeof brightness === 'string') {
// 如果传入的是页面名称,从映射中获取亮度
brightnessValue = BrightnessUtil.brightnessMap.get(brightness) || BrightnessUtil.DEFAULT_BRIG... | https://github.com/fbinba3955/Flymby | 04f8d58c9918893db1d85cbb228593a18140c57b | github |
openharmony/applications_mms | entry/src/main/ets/pages/index.ets | arkts | onPageHide | Triggers once when this page disappears. In scenarios such as routing and application access to the foreground
and background, only customized components modified by @Entry take effect. | onPageHide() {
this.mConListCtrl.onHide();
this.mIndexCtrl.onHide();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageHide 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... | onPageHide() {
this.mConListCtrl.onHide();
this.mIndexCtrl.onHide();
} | https://gitee.com/openharmony/applications_mms.git | b5dfccb208fc64ffc4f7b5c23c3125393ae4f4c7 | gitee |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets | arkts | deleteFromDeviceList | Deletes a device from the device list.
@param device Device information. | deleteFromDeviceList(device: deviceManager.DeviceInfo): void {
for (let i: number = 0; i < this.deviceList.length; i++) {
if (device.deviceId === this.deviceList[i].deviceId) {
this.deviceList.splice(i, 1);
break;
}
}
AppStorage.setOrCreate('deviceList', this.deviceList);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteFromDeviceList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left device... | deleteFromDeviceList(device: deviceManager.DeviceInfo): void {
for (let i: number = 0; i < this.deviceList.length; i++) {
if (device.deviceId === this.deviceList[i].deviceId) {
this.deviceList.splice(i, 1);
break;
}
}
AppStorage.setOrCreate('deviceList', this.deviceList);
} | https://gitee.com/openharmony/codelabs.git | bc9374b08e771078c8c899238cf9b9f3eb171274 | gitee |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/reminders/RemindersProcessor.ets | arkts | queryEventIdAndCreatorByReminder | 查询待插入的 reminder 数据中 event_id 与 event 表相同的结果
@param rdbStore rdb数据库
@param values 插入操作的数据
@return DataShareResultSet | async function queryEventIdAndCreatorByReminder(rdbStore: data_rdb.RdbStore,
values: data_rdb.ValuesBucket): Promise<data_rdb.ResultSet> {
const eventId = values[RemindersColumns.EVENT_ID] as ValueType;
const columns = [EventColumns.ID, EventColumns.CREATOR];
let pr... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left queryEventIdAndCreatorByReminder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#ide... | async function queryEventIdAndCreatorByReminder(rdbStore: data_rdb.RdbStore,
values: data_rdb.ValuesBucket): Promise<data_rdb.ResultSet> {
const eventId = values[RemindersColumns.EVENT_ID] as ValueType;
const columns = [EventColumns.ID, EventColumns.CREATOR];
let pr... | https://gitee.com/openharmony/applications_calendar_data.git | 855415f211037060b3b0c4f10e214529655b297c | gitee |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/SettingsManager.ets | arkts | setColorTheme | 设置主题配色 | async setColorTheme(theme: ColorTheme): Promise<void> {
await getThemeService().setColorTheme(theme)
// 通知所有监听者
const colors = getThemeService().getCurrentColors()
for (let i = 0; i < this.callbacks.length; i++) {
const callback = this.callbacks[i]
if (callback.onColorThemeChanged !== und... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setColorTheme AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left theme AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async setColorTheme(theme: ColorTheme): Promise<void> {
await getThemeService().setColorTheme(theme)
// 通知所有监听者
const colors = getThemeService().getCurrentColors()
for (let i = 0; i < this.callbacks.length; i++) {
const callback = this.callbacks[i]
if (callback.onColorThemeChanged !== und... | https://github.com/LongLiveY96/chatcube | 39abff4fbd13a22691689b655e8b046287afa8ad | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | contains | Contains method to check if an offset is within the size | contains(offset: Offset): boolean {
return offset.dx >= 0 && offset.dx < this.width && offset.dy >= 0 && offset.dy < this.height;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Offset AST#identifier#Right AST#)#Left ) AST#... | contains(offset: Offset): boolean {
return offset.dx >= 0 && offset.dx < this.width && offset.dy >= 0 && offset.dy < this.height;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L251-L253 | 8a4486c7a2fa503a1584a635af9be67e23e48ef7 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | addCustomIcon | 添加自定义图标到数据库
@param database 数据库实例
@param base64Image base64编码的图像数据(格式:data:image/png;base64,...)
@returns 添加的图标ID | public static async addCustomIcon(database: Kdbx, base64Images: string[], callback?: SaveDatabaseCallback) {
try {
if (!database || !base64Images || base64Images.length == 0) {
callback?.onError?.('Invalid database or base64 image');
return;
}
for (const base64Image of base64Imag... | 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 addCustomIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left database AST#identi... | public static async addCustomIcon(database: Kdbx, base64Images: string[], callback?: SaveDatabaseCallback) {
try {
if (!database || !base64Images || base64Images.length == 0) {
callback?.onError?.('Invalid database or base64 image');
return;
}
for (const base64Image of base64Imag... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L587-L613 | 43d59e882ff8358d53f08e7167a2b036263a07a4 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/Logger.ets | arkts | isFileLoggingEnabled | 获取是否启用文件日志 | static isFileLoggingEnabled(): boolean {
return Logger.isFileEnabled;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isFileLoggingEnabled 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 bool... | static isFileLoggingEnabled(): boolean {
return Logger.isFileEnabled;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | ed76788338fb728f18287ecb4d47bdc898a4db77 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | isLessThan | Checks if this instance value is less than value of provided instance
@param { Double } other Right hand side of the comparison
@returns { boolean } true if this value is less than provided, false otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isLessThan(other: Double): boolean {
return this.value < other.toDouble();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLessThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Doub... | public isLessThan(other: Double): boolean {
return this.value < other.toDouble();
} | https://gitcode.com/iop123123/arkts-static-skills | 49382bb1a4ccfcc8356fccc66a55206f1cac0f89 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsg.ets | arkts | onPageShow | Triggers once when this page is displayed. In scenarios such as routing and application access to the
foreground and background, only customized components modified by @Entry take effect. | onPageShow() {
this.mInfoMsgCtrl.onShow();
WantUtil.getWant();
} | 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.mInfoMsgCtrl.onShow();
WantUtil.getWant();
} | https://gitee.com/openharmony/applications_mms.git | f122a4617eafd53bb241e1ad1537ac9f68324fad | gitee |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | scanAndConnect | scan device then connect
@param callback | public scanAndConnect(callback: BleScanAndConnectCallback) {
if (callback == null) {
throw new Error("BleScanAndConnectCallback can not be Null!");
}
if (!this.isBlueEnable()) {
BleLog.e("Bluetooth not enable!");
callback.onScanStarted(false);
return;
}
let serviceUuids: ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left scanAndConnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public scanAndConnect(callback: BleScanAndConnectCallback) {
if (callback == null) {
throw new Error("BleScanAndConnectCallback can not be Null!");
}
if (!this.isBlueEnable()) {
BleLog.e("Bluetooth not enable!");
callback.onScanStarted(false);
return;
}
let serviceUuids: ... | https://gitee.com/openharmony-sig/FastBle.git | 922eb4d0afeba9093ebb84d2c92539316e3c5af2 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an iterable object.
@param { Iterable<BigInt> } arrayLike - An iterable object to convert to an array.
@param { function } [mapfn] - A mapping function to call on every element of the array.
@returns { BigUint64Array } - A new BigUint64Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageM... | public static from(arrayLike: Iterable<BigInt>, mapfn?: (v: BigInt, k: number) => BigInt): BigUint64Array {
if (mapfn == undefined) {
mapfn = (v: BigInt, k: number): BigInt => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code sectio... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie... | public static from(arrayLike: Iterable<BigInt>, mapfn?: (v: BigInt, k: number) => BigInt): BigUint64Array {
if (mapfn == undefined) {
mapfn = (v: BigInt, k: number): BigInt => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code sectio... | https://gitcode.com/iop123123/arkts-static-skills | 50e6e77b27f67d6290f530e8a5f1b9a25b5b477f | gitcode |
HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts | entry/src/main/ets/utils/ImageUtil.ets | arkts | compressImage | 压缩图片,等比例缩放图片的长宽 | public static async compressImage(sourcePixelMap: PixelMap): Promise<image.PixelMap> {
let imageScale = 1;
const reduceScale = 0.2;
const imagePackerApi = image.createImagePacker();
const packerOption: image.PackingOption = { format: 'image/jpeg', quality: 100 };
let compressedImageBuffer = await ... | 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 compressImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePixelMap AST#... | public static async compressImage(sourcePixelMap: PixelMap): Promise<image.PixelMap> {
let imageScale = 1;
const reduceScale = 0.2;
const imagePackerApi = image.createImagePacker();
const packerOption: image.PackingOption = { format: 'image/jpeg', quality: 100 };
let compressedImageBuffer = await ... | https://gitcode.com/HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts | a9fc29fa1b113d39d490f74ad2bff42c4d116caa | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component/treeview/source/treeview.ets | arkts | getCollapseImageNodeByType | get collapse image node by type
@param type collapse image node type
@returns collapse image node | static getCollapseImageNodeByType(type: CollapseImageType): CollapseImageNode {
let node: CollapseImageNode | undefined = CollapseImageNodeFlyweightFactory.nodeMap.get(type);
if (node === undefined) {
node = CollapseImageNodeFactory.getInstance().createCollapseImageNodeByType(type);
CollapseImageN... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCollapseImageNodeByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | static getCollapseImageNodeByType(type: CollapseImageType): CollapseImageNode {
let node: CollapseImageNode | undefined = CollapseImageNodeFlyweightFactory.nodeMap.get(type);
if (node === undefined) {
node = CollapseImageNodeFactory.getInstance().createCollapseImageNodeByType(type);
CollapseImageN... | https://gitee.com/openharmony/arkui_ace_engine.git | 926331e2037aba04ff643c9c5457a6675e7e17e2 | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/StringReader.ets | arkts | ReadByString | 如果给定的字符串在当前的字符索引中,读取字符串并更新索引位置
@param pendingReadString 要读取的字符串
@return 返回要被读取的字符串,未读取到返回空字符串 | public ReadByString(pendingReadString: string): string {
if (this.readStringFast(pendingReadString)) {
return pendingReadString;
}
if (!this._multiByteMode) {
return this.emptyString;
}
let length :number= pendingReadString.length;
let charLengthToMatch = this._getCharLength(pen... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left ReadByString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pendingReadString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | public ReadByString(pendingReadString: string): string {
if (this.readStringFast(pendingReadString)) {
return pendingReadString;
}
if (!this._multiByteMode) {
return this.emptyString;
}
let length :number= pendingReadString.length;
let charLengthToMatch = this._getCharLength(pen... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 132d412e9a0972192798ace5d0ea1d2e66d9c299 | gitee |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | setAudioRoute | 设置音频路由 | setAudioRoute(route: AudioRoute): void {
this.currentAudioRoute = route;
console.info(`[DeviceStore] 设置音频路由: ${route}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAudioRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left route AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AudioRoute AST#identifier#Right AST#)#Lef... | setAudioRoute(route: AudioRoute): void {
this.currentAudioRoute = route;
console.info(`[DeviceStore] 设置音频路由: ${route}`);
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 549b580e78b971f2c30be9739569faac424d1324 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/NetworkManager.ets | arkts | isNetworkAvailable | Check if network is available | static isNetworkAvailable(): boolean {
return isNetworkAvailable;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNetworkAvailable 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 boolea... | static isNetworkAvailable(): boolean {
return isNetworkAvailable;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 52e75e76d9e2b4d2543022ae7f70527c51950a47 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets | arkts | calculateBroadcastAddress | 计算广播地址
@param ipAddress IP地址字符串,例如 "192.168.2.13"
@param subnetMask 子网掩码字符串,例如 "255.255.255.0"
@returns 广播地址字符串 | function calculateBroadcastAddress(ipAddress: string, subnetMask: string): string {
// 将IP地址字符串转换为数字数组
const ipParts: number[] = ipAddress.split('.')
.map(Number)
// 将子网掩码字符串转换为数字数组
const subnetParts: number[] = subnetMask.split('.')
.map(Number)
// 计算每个字节的广播地址部分
const broadcastParts: number[] = []
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateBroadcastAddress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ipAddress AST#identifier#Right AST#type_annotation#Left AST#... | function calculateBroadcastAddress(ipAddress: string, subnetMask: string): string {
// 将IP地址字符串转换为数字数组
const ipParts: number[] = ipAddress.split('.')
.map(Number)
// 将子网掩码字符串转换为数字数组
const subnetParts: number[] = subnetMask.split('.')
.map(Number)
// 计算每个字节的广播地址部分
const broadcastParts: number[] = []
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 3421747b776c894c3a17127b325f77527bf2bb31 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | isGranularityEnabled | @return true if granularity is enabled | public isGranularityEnabled(): boolean {
return this.mGranularityEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGranularityEnabled 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 bool... | public isGranularityEnabled(): boolean {
return this.mGranularityEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 21d539cf9fba66bedd78ff5294269238269b0fb5 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/StoragePaths.ets | arkts | removeDir | 递归删除目录及其内容 | private static async removeDir(path: string): Promise<void> {
try {
const stat = await fs.stat(path)
if (stat.isDirectory()) {
const entries = await fs.listFile(path)
for (const entry of entries) {
await StoragePaths.removeDir(`${path}/${entry}`)
}
await fs.rm... | 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 removeDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path ... | private static async removeDir(path: string): Promise<void> {
try {
const stat = await fs.stat(path)
if (stat.isDirectory()) {
const entries = await fs.listFile(path)
for (const entry of entries) {
await StoragePaths.removeDir(`${path}/${entry}`)
}
await fs.rm... | https://github.com/AetheriumSimulator/qemu-hmos | 4045f3dad6ada591b591bdf4b7bd6c9253e4c3c4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | surface | 快捷方法:获取表面背景色 | public static get surface(): string {
return AppColors.surface;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left surface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#ca... | public static get surface(): string {
return AppColors.surface;
} | https://github.com/DaLongZhuaZi/manxia | 095ca0d08ae8f2e49b3b705c78f104d3db7c27a3 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock.ets | arkts | generateDevices | 为病房生成设备 | public generateDevices(roomId: string, roomNumber: string): DeviceInfo[] {
const deviceTypes = [
DeviceType.HOSPITAL_BED,
DeviceType.PATIENT_MONITOR,
DeviceType.SMART_LIGHT,
DeviceType.SMART_CURTAIN,
DeviceType.SMART_TV,
DeviceType.AIR_CONDITIONER,
DeviceType.CALL_BUTTON,... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left roomId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public generateDevices(roomId: string, roomNumber: string): DeviceInfo[] {
const deviceTypes = [
DeviceType.HOSPITAL_BED,
DeviceType.PATIENT_MONITOR,
DeviceType.SMART_LIGHT,
DeviceType.SMART_CURTAIN,
DeviceType.SMART_TV,
DeviceType.AIR_CONDITIONER,
DeviceType.CALL_BUTTON,... | https://github.com/LJ666-ui/harmony-health-care | 307b94645110750035ce03c40f74a40a6fd57a64 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | getDataView | Creates a DataView of the buffer
@returns {DataView} A DataView of the buffer
@private | private getDataView(): DataView {
return new DataView(this.buffer, this.byteOffset, this.length);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDataView 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 DataVie... | private getDataView(): DataView {
return new DataView(this.buffer, this.byteOffset, this.length);
} | https://gitcode.com/iop123123/arkts-static-skills | 5c26e62c1fcb42b610c0480326d8de11c584c1f9 | gitcode |
openharmony/applications_mms | entry/src/main/ets/utils/DateUtil.ets | arkts | convertTimeStampTime | @param timeStampFromDb
@param is24HourTime
@param that
@return | convertTimeStampTime(timeStampFromDb, is24HourTime) {
let sms = new Date(Number(timeStampFromDb));
let hoursOfSms = sms.getHours();
let minutesOfSms = sms.getMinutes();
let hoursOfSmsStr: string = hoursOfSms + '';
let minutesOfSmsStr: string = minutesOfSms + '';
if (hoursOfSms < 10) {
ho... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left convertTimeStampTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeStampFromDb AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left is24HourTime AST#identifier#Right AST#)#... | convertTimeStampTime(timeStampFromDb, is24HourTime) {
let sms = new Date(Number(timeStampFromDb));
let hoursOfSms = sms.getHours();
let minutesOfSms = sms.getMinutes();
let hoursOfSmsStr: string = hoursOfSms + '';
let minutesOfSmsStr: string = minutesOfSms + '';
if (hoursOfSms < 10) {
ho... | https://gitee.com/openharmony/applications_mms.git | a2333ad753d4ca779b88ddc52957f556126f721a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Workflow/WorkflowExecutor.ets | arkts | executeExtractStep | 执行提取步骤 | private executeExtractStep(
step: WorkflowStep,
context: WorkflowContext,
inputData: Object
): Object {
if (!step.extract) {
logger.debug(TAG, 'extract步骤未配置提取规则,返回输入数据');
return inputData;
}
const extractConfig = step.extract as JSONExtractConfig;
const extracted = this.apiE... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeExtractStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private executeExtractStep(
step: WorkflowStep,
context: WorkflowContext,
inputData: Object
): Object {
if (!step.extract) {
logger.debug(TAG, 'extract步骤未配置提取规则,返回输入数据');
return inputData;
}
const extractConfig = step.extract as JSONExtractConfig;
const extracted = this.apiE... | https://github.com/DaLongZhuaZi/manxia | 1c85902671d3a3fe26df2ca18dbaed051d9982de | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/animation/PageTransitionDemo_1.ets | arkts | pageTransition | pageTransition() - 用于设置当前页面移入和移出时的转场动画
PageTransitionEnter() - 页面移入时的转场动画
slide() - 整个页面的滑入滑出动画(SlideEffect 枚举)
Left, Right, Top, Bottom, START, END - 从指定的位置滑入
translate() - 整个页面的位移动画(参见 /component/shape/TransformDemo.ets 中的说明)
scale() - 整个页面的缩放动画(参见 /component/shape/TransformDemo.ets 中的说明)
opacity() - 整个页面的不透明度动画
Page... | pageTransition() {
PageTransitionEnter({
delay: 0,
duration: 1500,
curve: Curve.Ease,
type: RouteType.None
})
// 整个页面移入时的转场动画
.slide(SlideEffect.Left)
PageTransitionExit({
delay: 0,
duration: 1500,
curve: Curve.Ease,
type: RouteType.None
})
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pageTransition() {
PageTransitionEnter({
delay: 0,
duration: 1500,
curve: Curve.Ease,
type: RouteType.None
})
// 整个页面移入时的转场动画
.slide(SlideEffect.Left)
PageTransitionExit({
delay: 0,
duration: 1500,
curve: Curve.Ease,
type: RouteType.None
})
... | https://github.com/webabcd/HarmonyDemo | b2db1dba730372e139ab687c25a804e11fe500fd | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleCrashes.ets | arkts | appendThreadStacks | Append Worker/background-thread stacks to the primary stack trace when
`recordAllThreadsWithCrash` is enabled. If no provider is wired we log a
one-time warning (not per-crash, that would drown the log listener
during a crash loop) so integrators notice the flag is effectively inert.
Returns the original stack unchange... | private appendThreadStacks(primaryStack: string): string {
if (!this.config.recordAllThreadsWithCrash) return primaryStack;
if (!this.threadStackProvider) {
if (!this.missingProviderWarned) {
this.missingProviderWarned = true;
this.config.logger.w('[ModuleCrashes] recordAllThreadsWithCra... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendThreadStacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left primaryStack AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | private appendThreadStacks(primaryStack: string): string {
if (!this.config.recordAllThreadsWithCrash) return primaryStack;
if (!this.threadStackProvider) {
if (!this.missingProviderWarned) {
this.missingProviderWarned = true;
this.config.logger.w('[ModuleCrashes] recordAllThreadsWithCra... | https://github.com/Countly/countly-sdk-hos | 6e87a8525016a74a6d2cf74ac5e0ee19e6ffb82d | github |
openharmony/arkui_ace_engine | examples/AdvancedBlendMode/entry/src/main/ets/pages/ListDataSource.ets | arkts | deleteItem | 在指定索引位置删除一个元素 | public deleteItem(index: number): void {
this.list.splice(index, 1);
this.notifyDataDelete(index);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | public deleteItem(index: number): void {
this.list.splice(index, 1);
this.notifyDataDelete(index);
} | https://gitcode.com/openharmony/arkui_ace_engine | 0d440cee301dfec2d93c75bd71cb6ecca3fc9885 | gitcode |
openharmony/codelabs | Data/NotePadOpenHarmony/entry/src/main/ets/model/NotesDataModel.ets | arkts | saveDefaultData | Put the data in preferences. | async saveDefaultData() {
try {
let preferences = await dataStorage.getPreferences(this.context, CommonConstants.PREFERENCE_INSTANCE_NAME);
let isExist = await preferences.has(CommonConstants.PREFERENCE_NOTE_KEY);
if (!isExist) {
preferences.put(CommonConstants.PREFERENCE_NOTE_KEY, JSON.... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveDefaultData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#... | async saveDefaultData() {
try {
let preferences = await dataStorage.getPreferences(this.context, CommonConstants.PREFERENCE_INSTANCE_NAME);
let isExist = await preferences.has(CommonConstants.PREFERENCE_NOTE_KEY);
if (!isExist) {
preferences.put(CommonConstants.PREFERENCE_NOTE_KEY, JSON.... | https://gitee.com/openharmony/codelabs.git | 113a071a5a50aa5608196d102fef8484275041f3 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | has | Determines whether the list contains the specified element.
@param element The element to locate.
@returns True if the element is found, otherwise false. | public has(element: T): boolean {
let currentNode: ListNode<T> | undefined = this.head;
while (currentNode !== undefined) {
if (currentNode!.element == element) {
return true;
}
currentNode = currentNode!.next;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public has(element: T): boolean {
let currentNode: ListNode<T> | undefined = this.head;
while (currentNode !== undefined) {
if (currentNode!.element == element) {
return true;
}
currentNode = currentNode!.next;
}
return false;
} | https://gitcode.com/iop123123/arkts-static-skills | ccd808cab32142ecb24a60235942fe3930bde9ae | gitcode |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | exportToJSONAsync | 导出数据为JSON字符串(异步版本,使用taskpool避免主线程阻塞) | async exportToJSONAsync(
words: WordItem[],
definitions: ExportedDefinition[],
versionControl: VersionControl,
fsrsParamsJson: string = '',
userBooks: ExportedUserBook[] = [],
notebook: NotebookWordEntry[] = [],
texts: TextRow[] = [],
reviewEvents: ReviewEventRow[] = [],
dailyActiv... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exportToJSONAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left words AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async exportToJSONAsync(
words: WordItem[],
definitions: ExportedDefinition[],
versionControl: VersionControl,
fsrsParamsJson: string = '',
userBooks: ExportedUserBook[] = [],
notebook: NotebookWordEntry[] = [],
texts: TextRow[] = [],
reviewEvents: ReviewEventRow[] = [],
dailyActiv... | https://github.com/CLMC2025/Vignette | 2a92927eb4f84d12d2edce5a60d18973f6d302ee | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/contentSource/facades/LoggingInterceptorFacade.ets | arkts | setEnabled | 设置是否启用日志拦截器
@param enabled 是否启用 | setEnabled(enabled: boolean): void {
this.enabled = enabled;
logger.info(TAG, '日志拦截器已' + String(enabled ? '启用' : '禁用'));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) ... | setEnabled(enabled: boolean): void {
this.enabled = enabled;
logger.info(TAG, '日志拦截器已' + String(enabled ? '启用' : '禁用'));
} | https://github.com/DaLongZhuaZi/NGF | c924492380843886c7bba55d995d448c0857e810 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | getCachedChapterList | 从缓存获取章节列表
@param bookId 书籍ID
@param maxAgeHours 缓存最大有效时长(小时)
@returns 章节列表,如果缓存不存在则返回null | async getCachedChapterList(bookId: string, maxAgeHours: number = 24): Promise<LegadoChapter[] | null> {
try {
await this.ensureInitialized();
const normalizedMaxAgeHours = Number.isFinite(maxAgeHours) ? Math.max(0, maxAgeHours) : 24;
const maxAgeMs = normalizedMaxAgeHours * 60 * 60 * 1000;
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCachedChapterList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:... | async getCachedChapterList(bookId: string, maxAgeHours: number = 24): Promise<LegadoChapter[] | null> {
try {
await this.ensureInitialized();
const normalizedMaxAgeHours = Number.isFinite(maxAgeHours) ? Math.max(0, maxAgeHours) : 24;
const maxAgeMs = normalizedMaxAgeHours * 60 * 60 * 1000;
... | https://github.com/DaLongZhuaZi/manxia | f6889d7637d78537e731c005258011a0bb471605 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateKnock | 敲门振动 — 三连敲击 (咚咚咚),模拟敲门 | static vibrateKnock(): void {
VibratorManager.logExecution('vibrateKnock');
VibratorManager.vibratePattern([50, 120, 50, 120, 50], 1, VibrationUsage.TOUCH);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateKnock 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#expressio... | static vibrateKnock(): void {
VibratorManager.logExecution('vibrateKnock');
VibratorManager.vibratePattern([50, 120, 50, 120, 50], 1, VibrationUsage.TOUCH);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | a71c0e70cb19e9883378a963a3a937d1dde36fa3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | splitNotBlank | 字符串分割 | splitNotBlank(str: string, delimiter: string): string[] {
return str.split(delimiter).filter(s => s.trim() !== '');
} | 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 splitNotBlank AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#id... | splitNotBlank(str: string, delimiter: string): string[] {
return str.split(delimiter).filter(s => s.trim() !== '');
} | https://github.com/DaLongZhuaZi/manxia | e42674702cd91de0fed87a8eba3ee654c4e684ff | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | calculateBaselineFromBills | 从账单列表计算基线
@param bills 账单列表
@param userId 用户ID
@param categoryId 分类ID(0表示所有分类) | static calculateBaselineFromBills(
bills: Bill[],
userId: number,
categoryId: number = 0
): UserSpendingBaseline {
// 筛选符合条件的账单
const filteredBills: Bill[] = [];
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.userId === userId && bill.isDeleted === 0 && ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateBaselineFromBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | static calculateBaselineFromBills(
bills: Bill[],
userId: number,
categoryId: number = 0
): UserSpendingBaseline {
// 筛选符合条件的账单
const filteredBills: Bill[] = [];
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.userId === userId && bill.isDeleted === 0 && ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c63a8ba75f203f19b978528f9bffa5230636e4b6 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ValuesBucket.ets | arkts | get | 获取值
@param key 键名
@returns 值 | get(key: string): DbValueType {
const value = this.data.get(key)
if (value === undefined) {
return null
}
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Right ... | get(key: string): DbValueType {
const value = this.data.get(key)
if (value === undefined) {
return null
}
return value
} | https://github.com/offlinecat-dev/OCNetORM | fe27ad6356a46f19ac34ceffe0beae23076b1da9 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/VoiceGuide.ets | arkts | stopCurrentAnnouncement | 停止当前播报 | public stopCurrentAnnouncement(): void {
if (this.isSpeaking) {
// 实际实现需要调用TTS API停止
// tts.stop();
this.isSpeaking = false;
console.log('[VoiceGuide] 停止当前播报');
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopCurrentAnnouncement 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 AS... | public stopCurrentAnnouncement(): void {
if (this.isSpeaking) {
// 实际实现需要调用TTS API停止
// tts.stop();
this.isSpeaking = false;
console.log('[VoiceGuide] 停止当前播报');
}
} | https://github.com/LJ666-ui/harmony-health-care | bc1f766732ba13c233f51f5c58a3109211769814 | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/CommonUtil.ets | arkts | changeShadowColor | Set button shadow color.
@return button shadow color. | static changeShadowColor(resource: Resource): string | undefined {
let context = GlobalContext.getContext().getObject('clockContext') as Context;
if (context) {
let backgroundColor: string = context.resourceManager.getColorSync(resource).toString(16);
let colorSize = 6;
let shadowColor = '#'... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left changeShadowColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static changeShadowColor(resource: Resource): string | undefined {
let context = GlobalContext.getContext().getObject('clockContext') as Context;
if (context) {
let backgroundColor: string = context.resourceManager.getColorSync(resource).toString(16);
let colorSize = 6;
let shadowColor = '#'... | https://gitee.com/openharmony-sig/applications_clock.git | fde4c6b2df1f0023efbd3fe0ea47aca9f8bb73a6 | gitee |
openharmony-sig/fluttertpc_qr_code_scanner | ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets | arkts | hasCamera | 判断是否有前后置摄像头 | hasCamera(type: string = 'front') {
const cameraPosition =
type === 'front' ? camera.CameraPosition.CAMERA_POSITION_FRONT : camera.CameraPosition.CAMERA_POSITION_BACK;
let flag = false;
if (this.camerasDevices && this.camerasDevices.length) {
let backCamera = this.camerasDevices.find(el => el.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left hasCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left ... | hasCamera(type: string = 'front') {
const cameraPosition =
type === 'front' ? camera.CameraPosition.CAMERA_POSITION_FRONT : camera.CameraPosition.CAMERA_POSITION_BACK;
let flag = false;
if (this.camerasDevices && this.camerasDevices.length) {
let backCamera = this.camerasDevices.find(el => el.... | https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git | 089e4ef43b8c49e83f083914e10ab1502738d4ab | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | dumpActiveTasks | 转储所有活跃任务信息 | dumpActiveTasks(): TaskDumpInfo {
const pages: PageStats[] = [];
this.pageManagers.forEach((manager: IPageManager, pageId: string) => {
if (manager) {
const stats = manager.getStats();
pages.push({
pageId: stats.pageId || pageId,
timerCount: stats.timerCount || 0,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dumpActiveTasks 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 TaskDumpInfo AST#identifier#Right AST#ERROR#Ri... | dumpActiveTasks(): TaskDumpInfo {
const pages: PageStats[] = [];
this.pageManagers.forEach((manager: IPageManager, pageId: string) => {
if (manager) {
const stats = manager.getStats();
pages.push({
pageId: stats.pageId || pageId,
timerCount: stats.timerCount || 0,
... | https://github.com/DaLongZhuaZi/manxia | 97835202324efdf2b69b6f3d5e77dee45032ee3a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/AuthenticationHandler.ets | arkts | getValidToken | 获取有效的令牌(如果过期则返回null) | async getValidToken(): Promise<string | null> {
try {
const token = await this.getStoredToken();
if (!token) {
return null;
}
const isValid = await this.validateToken(token);
if (!isValid) {
logger.warn(TAG, `令牌无效,已清除: ${this.sourceId}`);
await this.clearToke... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getValidToken AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi... | async getValidToken(): Promise<string | null> {
try {
const token = await this.getStoredToken();
if (!token) {
return null;
}
const isValid = await this.validateToken(token);
if (!isValid) {
logger.warn(TAG, `令牌无效,已清除: ${this.sourceId}`);
await this.clearToke... | https://github.com/DaLongZhuaZi/manxia | 5072ee79bd355846bc656ee8edddff4bf9062a3b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | initialize | 初始化全局字体感知 | public static initialize(): void {
if (FontAwareHelper.isInitialized) return;
const fontManager = getFontManager();
// 监听字体变化
fontManager.addFontChangeListener('FontAwareHelper', (scene: FontScene, fontFamily: string) => {
FontAwareHelper.globalState.syncFromFontManager();
FontAw... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public static initialize(): void {
if (FontAwareHelper.isInitialized) return;
const fontManager = getFontManager();
// 监听字体变化
fontManager.addFontChangeListener('FontAwareHelper', (scene: FontScene, fontFamily: string) => {
FontAwareHelper.globalState.syncFromFontManager();
FontAw... | https://github.com/DaLongZhuaZi/manxia | 249b7891e769b32426bcaaaa3c3d0d68afe406ea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVNativeClient.ets | arkts | checkNativeModule | 延迟检查Native模块是否可用 | function checkNativeModule(): void {
if (nativeModuleChecked) return;
nativeModuleChecked = true;
try {
// 打印模块信息用于调试
logger.info(TAG, `Native模块类型: ${typeof webdavNativeModuleImport}`);
if (webdavNativeModuleImport) {
const moduleObj = webdavNativeModuleImport as WebDAVNativeModule;
con... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkNativeModule 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#predefine... | function checkNativeModule(): void {
if (nativeModuleChecked) return;
nativeModuleChecked = true;
try {
// 打印模块信息用于调试
logger.info(TAG, `Native模块类型: ${typeof webdavNativeModuleImport}`);
if (webdavNativeModuleImport) {
const moduleObj = webdavNativeModuleImport as WebDAVNativeModule;
con... | https://github.com/DaLongZhuaZi/manxia | 7771f3cc3c5b19b06179508d80b8d5c9c24a2cb3 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/MoonBridge.ets | arkts | nativeMicGetStats | 获取 native 麦克风统计信息 | nativeMicGetStats(): NativeMicStats {
return nativeLib.nativeMicGetStats();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nativeMicGetStats 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 NativeMicStats AST#identifier#Right AST#ERRO... | nativeMicGetStats(): NativeMicStats {
return nativeLib.nativeMicGetStats();
} | https://github.com/AlkaidLab/moonlight-harmony | 72f83392ac75521343c87cf1d5d35777c9ef6993 | github |
openharmony/applications_mms | entry/src/main/ets/service/ContractService.ets | arkts | judgeIsExitProfile | Check whether a business card exists.
@param actionData
@callback callback | judgeIsExitProfile(actionData, callback) {
globalThis.DataWorker.sendRequest('queryProfile', {
actionData: actionData,
context: globalThis.mmsContext
}, res => {
let result = false;
if (res > 0) {
result = true;
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left judgeIsExitProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#... | judgeIsExitProfile(actionData, callback) {
globalThis.DataWorker.sendRequest('queryProfile', {
actionData: actionData,
context: globalThis.mmsContext
}, res => {
let result = false;
if (res > 0) {
result = true;
}
... | https://gitee.com/openharmony/applications_mms.git | c7464ebcc49bc708419a2fa4ae2c4bdb93beb265 | gitee |
openharmony/arkui_ace_engine | examples/Accessibility/ListItemGroupAccessibility/entry/src/main/ets/pages/ListDataSource.ets | arkts | change1stItem | 修改第一个元素 | public change1stItem(temp: TimeTable): void {
this.list[0] = temp;
this.notifyDataChange(0);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left change1stItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left temp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ti... | public change1stItem(temp: TimeTable): void {
this.list[0] = temp;
this.notifyDataChange(0);
} | https://gitcode.com/openharmony/arkui_ace_engine | 3c741b58e69b9422573cb1faad55873c083ab32b | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/component/OmniFilterSingleList.ets | arkts | configOneLevelList | 配置单级节点的选中状态 | configOneLevelList(selectedEntity: OmniFilterItemBean): void {
if (selectedEntity.type === OmniFilterType.radio) {
// 单选,清空同级节点的选中状态
selectedEntity.parent?.clearChildSelectedStatus();
selectedEntity.isSelected = true;
} else if (selectedEntity.type === OmniFilterType.checkbox) {
if (se... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left configOneLevelList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selectedEntity AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left OmniFilterItemBean AST#iden... | configOneLevelList(selectedEntity: OmniFilterItemBean): void {
if (selectedEntity.type === OmniFilterType.radio) {
// 单选,清空同级节点的选中状态
selectedEntity.parent?.clearChildSelectedStatus();
selectedEntity.isSelected = true;
} else if (selectedEntity.type === OmniFilterType.checkbox) {
if (se... | https://github.com/wuba/omni-ui | 18046cd74d90588d1a587dad831e40e55a0c8f9d | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ExtensionLoader.ets | arkts | changeSshPrivateKeyPassphrase | 修改或移除私钥 passphrase
@return 新 PEM; 失败返回 "" | changeSshPrivateKeyPassphrase(privateKeyPem: string, oldPassphrase: string, newPassphrase: string): string {
try {
return rdpnapi.changeSshPrivateKeyPassphrase(privateKeyPem, oldPassphrase, newPassphrase) as string;
} catch (err) {
hilog.error(DOMAIN, TAG, '[ExtensionLoader] changeSshPrivateKeyPas... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left changeSshPrivateKeyPassphrase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left privateKeyPem AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig... | changeSshPrivateKeyPassphrase(privateKeyPem: string, oldPassphrase: string, newPassphrase: string): string {
try {
return rdpnapi.changeSshPrivateKeyPassphrase(privateKeyPem, oldPassphrase, newPassphrase) as string;
} catch (err) {
hilog.error(DOMAIN, TAG, '[ExtensionLoader] changeSshPrivateKeyPas... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | fc9f092153c8b02f4d0c72624b6eea294520c041 | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/viewmodels/SettingsViewModel.ets | arkts | addOrUpdateOverride | Adds or updates a day override and recalibrates working days. | public addOrUpdateOverride(override: DayOverride): void {
const idx: number = this.dayOverrides.findIndex(
(d: DayOverride) => d.dateString === override.dateString
)
if (idx >= 0) {
const updated: DayOverride[] = [...this.dayOverrides]
updated[idx] = override
this.dayOverrides = up... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addOrUpdateOverride AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public addOrUpdateOverride(override: DayOverride): void {
const idx: number = this.dayOverrides.findIndex(
(d: DayOverride) => d.dateString === override.dateString
)
if (idx >= 0) {
const updated: DayOverride[] = [...this.dayOverrides]
updated[idx] = override
this.dayOverrides = up... | https://github.com/OMGCA/sakipay | 6bbc43bc64fd6ecd58cf689f9ed40c88c766eaf6 | github |
webabcd/HarmonyDemo | feature1/src/main/ets/feature1ability/Feature1Ability.ets | arkts | parseWantParameter | 解析 Want 中的参数,并保存在 AppStorage 中 | parseWantParameter(want: Want) {
let k1 = ""
let k2 = ""
if (want.parameters?.k1) {
k1 = want.parameters.k1.toString()
}
if (want.parameters?.k2) {
k2 = want.parameters.k2.toString()
}
AppStorage.setOrCreate("k1", k1)
AppStorage.setOrCreate("k2", k2)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseWantParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Ri... | parseWantParameter(want: Want) {
let k1 = ""
let k2 = ""
if (want.parameters?.k1) {
k1 = want.parameters.k1.toString()
}
if (want.parameters?.k2) {
k2 = want.parameters.k2.toString()
}
AppStorage.setOrCreate("k1", k1)
AppStorage.setOrCreate("k2", k2)
} | https://github.com/webabcd/HarmonyDemo | 2bd74d0115ca043427f83f7ac315041d3efe4e09 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | clearMemory | clear menory | private async clearMemory(): Promise<void> {
this.saveMemory('');
} | 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 clearMemory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | private async clearMemory(): Promise<void> {
this.saveMemory('');
} | https://gitee.com/openharmony-sig/applications_calculator.git | bd398356ca7ebc0518531533267a67fe8c993b74 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/historyrecord/HistoryRecordController.ets | arkts | deleteRecordById | delete current record
@param record id | deleteRecordById(id: string): void {
LogUtil.info(TAG, 'deleteRecords start');
this.expressionsModel.deleteRecordById(id, (rows: number) => {
if (this.expDataSource.totalCount() === 0) {
this.isEmptyView = true;
}
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteRecordById 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 string AST#identifier#Right AST#)#Left ) ... | deleteRecordById(id: string): void {
LogUtil.info(TAG, 'deleteRecords start');
this.expressionsModel.deleteRecordById(id, (rows: number) => {
if (this.expDataSource.totalCount() === 0) {
this.isEmptyView = true;
}
});
} | https://gitee.com/openharmony-sig/applications_calculator.git | d30a94c6f87ecec4808b23bcaa2952ad7e5736cb | gitee |
tdcare/tdwebrtc | src/main/ets/CameraCapture.ets | arkts | switchCamera | ============================================================
前后摄像头切换
============================================================
切换前后摄像头
需要调用方先 stop/release,再用新配置 initialize/start。 | public async switchCamera(): Promise<boolean> {
const newPosition: 'back' | 'front' = this.config.cameraPosition === 'back' ? 'front' : 'back';
this.config.cameraPosition = newPosition;
LogUtil.info(`[CameraCapture] 切换到 ${newPosition} 摄像头`);
return true;
} | 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 switchCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async switchCamera(): Promise<boolean> {
const newPosition: 'back' | 'front' = this.config.cameraPosition === 'back' ? 'front' : 'back';
this.config.cameraPosition = newPosition;
LogUtil.info(`[CameraCapture] 切换到 ${newPosition} 摄像头`);
return true;
} | https://github.com/tdcare/tdwebrtc | db9acd51b2c2bb776424f19564a52b6944490969 | github |
universesons/arcts | entry/src/main/ets/view/information/InformationListItem.ets | arkts | build | 身高 单位:厘米 | build() {
Row() {
Row() {
Text('身高')
.fontSize(20)
.fontColor($r('app.color.titleColor'))
}
Text(this.userHeight + " " + Const.HEIGHT_UNIT).fontSize(20)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 12 })
} | 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() {
Row() {
Row() {
Text('身高')
.fontSize(20)
.fontColor($r('app.color.titleColor'))
}
Text(this.userHeight + " " + Const.HEIGHT_UNIT).fontSize(20)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 12, right: 12 })
} | https://github.com/universesons/arcts | cbf9bbb5afa3df0a7245bb7b9b97b256ba429b57 | github |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/ServerManager.ets | arkts | generateScid | 生成随机scid(31位非负整数的十六进制表示,避免Java端NumberFormatException) | private static generateScid(): string {
// Generate a random integer between 0 and 0x7FFFFFFF (31-bit positive integer)
const scid = Math.floor(Math.random() * 0x80000000);
const scidHex = scid.toString(16).padStart(8, '0');
ServerManager.lastScid = scidHex;
return scidHex;
} | 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 generateScid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private static generateScid(): string {
// Generate a random integer between 0 and 0x7FFFFFFF (31-bit positive integer)
const scid = Math.floor(Math.random() * 0x80000000);
const scidHex = scid.toString(16).padStart(8, '0');
ServerManager.lastScid = scidHex;
return scidHex;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | e926463085ebe90d8a20b8269ed259c42cd23e5a | github |
harmonyos/codelabs | HarmonyOS_NEXT/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartViewModel.ets | arkts | initCurveData | Init data.
@param count Init data count. | private initCurveData(count: number): LineData {
let values = this.initRandomValue(count);
let gradientFillColor = new Array<ColorStop>();
gradientFillColor.push(['#661f69ff', 0.1])
gradientFillColor.push(['#00eff6ff', 1.0])
let dataSet = new JArrayList<ILineDataSet>();
let set1 = new LineD... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initCurveData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private initCurveData(count: number): LineData {
let values = this.initRandomValue(count);
let gradientFillColor = new Array<ColorStop>();
gradientFillColor.push(['#661f69ff', 0.1])
gradientFillColor.push(['#00eff6ff', 1.0])
let dataSet = new JArrayList<ILineDataSet>();
let set1 = new LineD... | https://gitee.com/harmonyos/codelabs.git | 2c74e4a6651ae23a99e98791e9b46d9f61681137 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | get | Gets the int value wrapped in this IntBox.
@returns { int } The int value wrapped in this IntBox
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get(): int {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | public get(): int {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | bb619c8cc53a657f96dafe890bc03d8cf937509e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | evictDiskCacheIfNeeded | 磁盘缓存淘汰 | private async evictDiskCacheIfNeeded(): Promise<void> {
try {
// 使用内存追踪的大小,避免每次都扫描目录
if (this.diskCacheSize <= this.config.diskCache.maxSize) {
return;
}
// 按最后访问时间排序
const sortedEntries = Array.from(this.diskCacheIndex.values())
.sort((a, b) => a.lastAccessTim... | 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 evictDiskCacheIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#... | private async evictDiskCacheIfNeeded(): Promise<void> {
try {
// 使用内存追踪的大小,避免每次都扫描目录
if (this.diskCacheSize <= this.config.diskCache.maxSize) {
return;
}
// 按最后访问时间排序
const sortedEntries = Array.from(this.diskCacheIndex.values())
.sort((a, b) => a.lastAccessTim... | https://github.com/DaLongZhuaZi/manxia | 2142b1d7763714e5e9c29ea32542a8597d7dc3cf | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneStream.ets | arkts | toggle | 切换麦克风状态(暂停/恢复) | async toggle(): Promise<boolean> {
if (!this.running) {
// 如果未运行,尝试启动
return this.start();
}
if (this.paused) {
await this.resume();
} else {
await this.pause();
}
return !this.paused;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left toggle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Le... | async toggle(): Promise<boolean> {
if (!this.running) {
// 如果未运行,尝试启动
return this.start();
}
if (this.paused) {
await this.resume();
} else {
await this.pause();
}
return !this.paused;
} | https://github.com/AlkaidLab/moonlight-harmony | 6af6d06f85594b68a16a85e390c8db3b2588ccee | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toHexadecimal | Return a string representing the value of this Decimal in base 16
@returns { string } the string type | public toHexadecimal(): string {
return this.toStringBinary(16);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toHexadecimal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public toHexadecimal(): string {
return this.toStringBinary(16);
} | https://gitcode.com/iop123123/arkts-static-skills | 39af4c18f261eea5ed49090be7a157bb2b775f2f | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/AttendanceService.ets | arkts | getAttendanceDetail | ===== 获取签到详情 ===== | async getAttendanceDetail(
courseId: string,
clazzId: string,
page: number,
pageSize: number
): Promise<ClassAttendanceDetail[]> {
try {
await this.ensureLogin();
const url: string = buildUrl(COURSE_DETAIL_URL, {
'classId': clazzId,
'courseId': courseId,
'pag... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAttendanceDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left courseId AST#identifier#Right AST#type_annotation#Left AST#... | async getAttendanceDetail(
courseId: string,
clazzId: string,
page: number,
pageSize: number
): Promise<ClassAttendanceDetail[]> {
try {
await this.ensureLogin();
const url: string = buildUrl(COURSE_DETAIL_URL, {
'classId': clazzId,
'courseId': courseId,
'pag... | https://github.com/PollenWang6/HiXD | 6e16da7eb583bbc04a3e8e05ade3e5e2f998e358 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | getDownloadSubdirInfo | ==================== Download文件夹分析方法 ====================
获取Download目录下的子目录信息 | private async getDownloadSubdirInfo(subPath: string): Promise<DirectoryInfo> {
try {
if (!DownloadDirManager.isReady()) {
return { size: 0, count: 0 };
}
const basePath = DownloadDirManager.getPath();
const fullPath = `${basePath}/${subPath}`;
try {
SafeFileUti... | 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 getDownloadSubdirInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left subPath AST#identifier#Right AST#ERROR#Left AS... | private async getDownloadSubdirInfo(subPath: string): Promise<DirectoryInfo> {
try {
if (!DownloadDirManager.isReady()) {
return { size: 0, count: 0 };
}
const basePath = DownloadDirManager.getPath();
const fullPath = `${basePath}/${subPath}`;
try {
SafeFileUti... | https://github.com/DaLongZhuaZi/manxia | db01af7ba23e87fd81f64d83b9776f4f10f70827 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | isGreaterEqualThan | Checks if this instance value is greater than or equal to value of provided instance
@param { Byte } other Right hand side of the comparison
@returns { boolean }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public isGreaterEqualThan(other: Byte): boolean {
return this.value >= other.toByte();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGreaterEqualThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Byte AST#ide... | public isGreaterEqualThan(other: Byte): boolean {
return this.value >= other.toByte();
} | https://gitcode.com/iop123123/arkts-static-skills | 76ecb5b3bc0ce119be853612324ee755d09c7dd5 | gitcode |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/view/MyDemoOldView.ets | arkts | onConfirm | 保存用户隐私协议状态 | onConfirm() {
this.getPreferences().then((preferences: preferences.Preferences) => {
const put = preferences.put(Const.PREFERENCES, false)
preferences.flush()
put.then(() => {
hilog.info(this.domain, this.tag, `${this.tag}: 保存用户隐私协议状态成功`)
}).catch((error: BusinessError) => {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onConfirm 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 AST... | onConfirm() {
this.getPreferences().then((preferences: preferences.Preferences) => {
const put = preferences.put(Const.PREFERENCES, false)
preferences.flush()
put.then(() => {
hilog.info(this.domain, this.tag, `${this.tag}: 保存用户隐私协议状态成功`)
}).catch((error: BusinessError) => {
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | d936e6db07b8e2f96a215772d04274614b74fd26 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets | arkts | testConnection | ==================== 公共方法 ====================
测试WebDAV连接
策略:直接尝试在目标目录上传测试文件,根据响应判断:
- 201/200/204: 目录存在且可写
- 404/409: 目录不存在
- 401: 认证失败
- 405: 服务器不支持PUT(可能是只读或配置问题) | async testConnection(): Promise<WebDAVTestResult> {
const baseUrl = this.config.serverUrl.replace(/\/$/, '');
const basePath = this.config.basePath.replace(/^\//, '').replace(/\/$/, '');
const fullUrl = basePath ? `${baseUrl}/${basePath}/` : `${baseUrl}/`;
logger.info(TAG, '开始测试WebDAV连接');
lo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left testConnection AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener... | async testConnection(): Promise<WebDAVTestResult> {
const baseUrl = this.config.serverUrl.replace(/\/$/, '');
const basePath = this.config.basePath.replace(/^\//, '').replace(/\/$/, '');
const fullUrl = basePath ? `${baseUrl}/${basePath}/` : `${baseUrl}/`;
logger.info(TAG, '开始测试WebDAV连接');
lo... | https://github.com/DaLongZhuaZi/manxia | b4beb45c8b9c628662208ae2c9c0a0f17bd73cf5 | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/viewmodels/DashboardViewModel.ets | arkts | refresh | Refreshes earnings data. Re-reads voluntary OT session state from the store
on every call so that widget toggles are picked up by the app. | public refresh(): void {
this.store.loadVoluntaryOTActive().then((isActive: boolean): void => {
this.isVoluntaryOvertimeActive = isActive
this.store.voluntaryOvertimeTotalSeconds().then((totalOTSeconds: number): void => {
const today: TodayEarnings = this.calculator.calculateTodayEarnings(new ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left refresh 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_sta... | public refresh(): void {
this.store.loadVoluntaryOTActive().then((isActive: boolean): void => {
this.isVoluntaryOvertimeActive = isActive
this.store.voluntaryOvertimeTotalSeconds().then((totalOTSeconds: number): void => {
const today: TodayEarnings = this.calculator.calculateTodayEarnings(new ... | https://github.com/OMGCA/sakipay | 310da0da7c6124dac5d0fd5e298eba53e3f89766 | github |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/pages/MainPage.ets | arkts | getIconResource | 图标资源映射
维护建议:将新增图标存入 resources/base/media 后在此处添加对应的 case | getIconResource(title: string): Resource {
switch (title) {
case '电池':
return $r('app.media.ic_battery');
case '网络':
return $r('app.media.ic_network');
case '存储':
return $r('app.media.ic_storage');
case '屏幕':
return $r('app.media.ic_screen');
default:
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIconResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | getIconResource(title: string): Resource {
switch (title) {
case '电池':
return $r('app.media.ic_battery');
case '网络':
return $r('app.media.ic_network');
case '存储':
return $r('app.media.ic_storage');
case '屏幕':
return $r('app.media.ic_screen');
default:
... | https://gitcode.com/openharmony/codelabs | df08c9f89dcd89a5769a8f9f109322877a691bcc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | processJsResult | 处理JS执行结果,提取需要保存的数据 | private processJsResult(sourceId: string, resultStr: string | undefined): void {
if (!resultStr) return;
try {
// 尝试解析为JSON
const result = SafeUtils.parseObj(resultStr) as Record<string, ESObject>;
// 检查是否有loginHeader需要保存
if (result['loginHeader']) {
const header = ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processJsResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | private processJsResult(sourceId: string, resultStr: string | undefined): void {
if (!resultStr) return;
try {
// 尝试解析为JSON
const result = SafeUtils.parseObj(resultStr) as Record<string, ESObject>;
// 检查是否有loginHeader需要保存
if (result['loginHeader']) {
const header = ... | https://github.com/DaLongZhuaZi/manxia | 6ba335ec055bf9f642bddf5cc8cda7bbc8280533 | github |
YDYm233/EasyRandom_HarmonyNextApp | product/default/src/main/ets/sub_pages/blessing_muyu/BlessingMuyu_V2Page.ets | arkts | onPageShow | 页面每次回到前台时,从 Preferences 重新读取最新计数
(卡片点击不打开应用,只写磁盘;页面回来时同步) | onPageShow(): void {
this.syncCountFromPrefs()
} | AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onPageShow(): void {
this.syncCountFromPrefs()
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | d0a6a53a864b70cb87be73fc2be5aa20910f9e54 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Guard/Fake/FakeTelPage.ets | arkts | onAnswering | 模拟接听电话 | onAnswering() {
// 显示接听界面
this.isAnswering = true
// 播放预先录制好的声音
avPlayerManager.playByRawSrc('lab_voice_trick_7.m4a')
// 取消循环播放
avPlayerManager.setLoop(false)
// 开启计时
this.startCounter()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAnswering 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... | onAnswering() {
// 显示接听界面
this.isAnswering = true
// 播放预先录制好的声音
avPlayerManager.playByRawSrc('lab_voice_trick_7.m4a')
// 取消循环播放
avPlayerManager.setLoop(false)
// 开启计时
this.startCounter()
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 923452f2d9748d06895f5d97d54db43087f56c53 | gitcode |
HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | entry/src/main/ets/pages/Index.ets | arkts | onComplete | 识别完成回调 | onComplete(sessionId: string, eventMessage: string) {
console.info(TAG, `onComplete, sessionId: ${sessionId} eventMessage: ${eventMessage}`);
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,... | onComplete(sessionId: string, eventMessage: string) {
console.info(TAG, `onComplete, sessionId: ${sessionId} eventMessage: ${eventMessage}`);
}, | https://gitcode.com/HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-asrdemo | 84d365e4526499e247ab5f50b60a55130635b1cd | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/FuzzyMatchUtil.ets | arkts | getStringSimilarity | returns similarity of strA and strB in percentage number (0~100) when it reaches threshold,
or returns 0 when under threshold.
@param matchThreshold
@param matchMethod
@returns | public static getStringSimilarity(strA: string, strB: string, matchRateThreshold: number = 0,
matchMethod: Function = ((strA: string, strB: string) => {
})): number {
let matchResult: number = 0;
let matchSimRate: number = 0;
const shortLen = Math.min(strA.length, strB.length);
if (matchRat... | 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 getStringSimilarity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strA AST#identifier#Right AST#:#Lef... | public static getStringSimilarity(strA: string, strB: string, matchRateThreshold: number = 0,
matchMethod: Function = ((strA: string, strB: string) => {
})): number {
let matchResult: number = 0;
let matchSimRate: number = 0;
const shortLen = Math.min(strA.length, strB.length);
if (matchRat... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | ded70db49c82510bf460442053063d8ec13d7b32 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array-like or iterable object.
@param { Iterable<number> } arrayLike - An array-like or iterable object to convert to an array.
@param { function } [mapfn] - A mapping function to call on every element of the array.
@returns { Int16Array } - A new Int16Array
@static
@syscap SystemCapability.Uti... | public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Int16Array {
if (mapfn == undefined) {
mapfn = (v: number, k: number): number => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code section is... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie... | public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Int16Array {
if (mapfn == undefined) {
mapfn = (v: number, k: number): number => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code section is... | https://gitcode.com/iop123123/arkts-static-skills | bab3b4d33dbd0d191886c42af84d657fd58ec86a | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component/subheader/source/subheader.ets | arkts | isSymbolResource | 是否symbol资源
@param resourceStr 资源
@returns true:symbol资源;false:非symbol资源 | public static isSymbolResource(resourceStr: ResourceStr | undefined): boolean {
if (!Util.isResourceType(resourceStr)) {
return false;
}
let resource = resourceStr as Resource;
return resource?.type === RESOURCE_TYPE_SYMBOL;
} | 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 isSymbolResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resourceStr AST#identifier#Right AST#:... | public static isSymbolResource(resourceStr: ResourceStr | undefined): boolean {
if (!Util.isResourceType(resourceStr)) {
return false;
}
let resource = resourceStr as Resource;
return resource?.type === RESOURCE_TYPE_SYMBOL;
} | https://gitee.com/openharmony/arkui_ace_engine.git | 8add5e33bbb94a0cf174ccb3ee46507a05aa40d8 | gitee |
XXYoLoong/FortuneBet | entry/src/main/ets/services/ProbabilityPredictor.ets | arkts | simulate | 批量模拟开奖,返回统计分布。 | simulate(times: number, randomFn: () => number = Math.random): ProbabilityReport {
if (times <= 0) {
throw new Error('simulate times must be positive');
}
const counts = new Map<number, number>();
for (let i = 0; i < times; i++) {
const result = this.pick(randomFn);
counts.set(result... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left simulate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left times AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,... | simulate(times: number, randomFn: () => number = Math.random): ProbabilityReport {
if (times <= 0) {
throw new Error('simulate times must be positive');
}
const counts = new Map<number, number>();
for (let i = 0; i < times; i++) {
const result = this.pick(randomFn);
counts.set(result... | https://github.com/XXYoLoong/FortuneBet | 944106edff5fc75b67adedbb482d3907fef71327 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | isMouseInterceptorActive | 查询 C++ Monitor 是否激活 | isMouseInterceptorActive(): boolean {
return this.mouseInterceptorActive;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isMouseInterceptorActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Righ... | isMouseInterceptorActive(): boolean {
return this.mouseInterceptorActive;
} | https://github.com/AlkaidLab/moonlight-harmony | d7fa121fb0fc62fd5cb268bb497c999140463a9f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets | arkts | isEnabled | 是否启用阅读数据收集 | public isEnabled(): boolean {
logger.debug(TAG, `isEnabled() 被调用,返回: ${this.settings.enabled}`);
return this.settings.enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boo... | public isEnabled(): boolean {
logger.debug(TAG, `isEnabled() 被调用,返回: ${this.settings.enabled}`);
return this.settings.enabled;
} | https://github.com/DaLongZhuaZi/manxia | 22e8f31be15f89fbf7bde120fc0ce1b21c3a6245 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | getInt32 | Gets an signed integer.
@param byteOffset The byte offset.
@param littleEndian If the value is little endian.
@returns The value. | getInt32(byteOffset: number, littleEndian?: boolean): number {
return this.dataView?.getInt32(byteOffset, littleEndian) ?? 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInt32 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 , AST#,#Ri... | getInt32(byteOffset: number, littleEndian?: boolean): number {
return this.dataView?.getInt32(byteOffset, littleEndian) ?? 0
} | https://gitee.com/openharmony-sig/flutter_engine.git | 32421ae54ee94934daf485c3476a07ac6a9e8581 | gitee |
erosTeam/NextE | shared/src/main/ets/model/SimpleTag.ets | arkts | localizedDisplay | Localize the raw key while preserving EH's original visible prefix decision. | localizedDisplay(localized: string): string {
const text: string = localized.trim()
if (text.length === 0) {
return text
}
if (this.siteLabel.length === 0 || this.siteLabel === this.text) {
return text
}
const suffix: string = `:${this.text}`
if (this.siteLabel.endsWith(suffix)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left localizedDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left localized AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | localizedDisplay(localized: string): string {
const text: string = localized.trim()
if (text.length === 0) {
return text
}
if (this.siteLabel.length === 0 || this.siteLabel === this.text) {
return text
}
const suffix: string = `:${this.text}`
if (this.siteLabel.endsWith(suffix)... | https://github.com/erosTeam/NextE | 1ea3747d06b6c96b1e3577fe035f2a27a800e989 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/ToolComponent.ets | arkts | build | 功能数组 暂只有语音通话 | build() {
Row() {
ForEach(this.toolArray, (item: ToolData, index) => {
Button() {
Image(item.getImgResource())
.width(40)
.height(40)
.objectFit(ImageFit.Contain)
}
.width(100)
.height(100)
.borderRadius(10)
.type(... | 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() {
Row() {
ForEach(this.toolArray, (item: ToolData, index) => {
Button() {
Image(item.getImgResource())
.width(40)
.height(40)
.objectFit(ImageFit.Contain)
}
.width(100)
.height(100)
.borderRadius(10)
.type(... | https://github.com/openharmony/applications_app_samples | 36f039fb1e639fcd31b97ba81e2f23a8b59b553a | github |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | registerArticleEntity | ============================================
第一步:注册实体(使用 MetadataStorage API)
============================================
注册文章实体 | function registerArticleEntity(): void {
const storage = MetadataStorage.getInstance()
// 注册实体
storage.registerEntity('ArticleEntity', 'articles')
// 注册主键列
const idColumn = new ColumnMetadata('id', 'id')
idColumn.setType(ColumnType.INTEGER)
idColumn.setPrimaryKey(true)
idColumn.setAutoIncrement(true)
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left registerArticleEntity 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#prede... | function registerArticleEntity(): void {
const storage = MetadataStorage.getInstance()
// 注册实体
storage.registerEntity('ArticleEntity', 'articles')
// 注册主键列
const idColumn = new ColumnMetadata('id', 'id')
idColumn.setType(ColumnType.INTEGER)
idColumn.setPrimaryKey(true)
idColumn.setAutoIncrement(true)
... | https://github.com/offlinecat-dev/OCNetORM | 04adf4402062caead0ffa3fb0e2026b16ba76bc8 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/SubQueryRelationExecutor.ets | arkts | executeSubQueryManyToMany | 执行 MANY_TO_MANY 关系的子查询
先查询目标表获取符合条件的目标实体主键,再查询中间表获取关联的源实体 ID | private async executeSubQueryManyToMany(
subQuery: SubQuery,
store: relationalStore.RdbStore,
relation: ManyToManyMetadata,
targetTableName: string
): Promise<Array<ValueType>> {
// 获取目标实体元数据
const metadata = MetadataStorage.getInstance()
const targetEntityMetadata = metadata.getEntityMe... | 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 executeSubQueryManyToMany AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left subQuery AST#identifier#Rig... | private async executeSubQueryManyToMany(
subQuery: SubQuery,
store: relationalStore.RdbStore,
relation: ManyToManyMetadata,
targetTableName: string
): Promise<Array<ValueType>> {
// 获取目标实体元数据
const metadata = MetadataStorage.getInstance()
const targetEntityMetadata = metadata.getEntityMe... | https://github.com/offlinecat-dev/OCNetORM | 9381ed33fdb356be3b78995901686d1ca3c6bcdd | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | setCryptoStatus | 设置加密状态 (跨设备信令) | setCryptoStatus(status: string): void {
if (!this.store) { return; }
try {
const vb: relationalStore.ValuesBucket = { 'id': 'status', 'key': 'crypto_status', 'value': status };
this.store.insertSync('cryptoparams', vb, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
this.lastKnownCr... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCryptoStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left... | setCryptoStatus(status: string): void {
if (!this.store) { return; }
try {
const vb: relationalStore.ValuesBucket = { 'id': 'status', 'key': 'crypto_status', 'value': status };
this.store.insertSync('cryptoparams', vb, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
this.lastKnownCr... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 2c2e694b7a909858a648f8ce634230d5b191e1df | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | constructor | Creates a new `BigInt` instance from a boolean value.
@param { boolean } d The boolean value (true=1, false=0).
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(d: boolean) {
const oz = d ? 1 : 0
this.sign = oz
this.bytes = this.sign == 0
? [] as ValueArray<int>
: BigInt.fromLongHelper(oz.toLong(), 1, this.sign)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST... | constructor(d: boolean) {
const oz = d ? 1 : 0
this.sign = oz
this.bytes = this.sign == 0
? [] as ValueArray<int>
: BigInt.fromLongHelper(oz.toLong(), 1, this.sign)
} | https://gitcode.com/iop123123/arkts-static-skills | 986c015c5eb53609175c9c78927dcb6f1780ad05 | gitcode |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets | arkts | sendData | 发送数据
@param data | async sendData(data: string): Promise<void> {
if (!this.tcpSocket) {
return;
}
Logger.info(`${TAG} tcp sendData data ${JSON.stringify(data)}`);
try {
await this.tcpSocket.send({
data: data,
});
} catch (e) {
Logger.error(`${TAG} tcp sendData error ${JSON.stringify(e... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sendData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_a... | async sendData(data: string): Promise<void> {
if (!this.tcpSocket) {
return;
}
Logger.info(`${TAG} tcp sendData data ${JSON.stringify(data)}`);
try {
await this.tcpSocket.send({
data: data,
});
} catch (e) {
Logger.error(`${TAG} tcp sendData error ${JSON.stringify(e... | https://github.com/openharmony/applications_app_samples | 4c556e241efa5a21c34eeeae2be563b09e5b6ee2 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitFixed32 | 访问 fixed32 字段
JSON: number | visitFixed32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitFixed32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , A... | visitFixed32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 18f6db022085e44a90cc1bd3633929e06ee6fd5f | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/types/EntityConstructor.ets | arkts | register | 注册实体
@param entityName 实体类名称
@param tableName 表名 | static register(entityName: string, tableName: string): void {
const info = new EntityInfo(entityName, tableName)
EntityRegistry.entityMap.set(entityName, info)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | static register(entityName: string, tableName: string): void {
const info = new EntityInfo(entityName, tableName)
EntityRegistry.entityMap.set(entityName, info)
} | https://github.com/offlinecat-dev/OCNetORM | a41e16338271bfeff1ffc02b18327ddf8b2e50cb | github |
openharmony-tpc/ImageKnife | library/src/main/ets/utils/FileUtils.ets | arkts | existFolder | 判断文件夹是否存在
@param path 文件夹绝对路径 | existFolder(path: string): boolean {
try {
if (fs.accessSync(path)) {
let stat = fs.statSync(path)
return stat.isDirectory()
} else {
return false
}
}
catch (error) {
let err: BusinessError = error as BusinessError;
LogUtil.error('FileUtils existFolder... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left existFolder 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 ) AST... | existFolder(path: string): boolean {
try {
if (fs.accessSync(path)) {
let stat = fs.statSync(path)
return stat.isDirectory()
} else {
return false
}
}
catch (error) {
let err: BusinessError = error as BusinessError;
LogUtil.error('FileUtils existFolder... | https://gitee.com/openharmony-tpc/ImageKnife.git | 94735ea630d79af3dfc41f4efc91891f746b331b | gitee |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/stores/AuthStore.ets | arkts | getCurrentUserId | 获取当前用户 ID | static getCurrentUserId(): string {
return AppStorage.get<string>(AppStorageKeys.CURRENT_USER_ID) || ''
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AS... | static getCurrentUserId(): string {
return AppStorage.get<string>(AppStorageKeys.CURRENT_USER_ID) || ''
} | https://github.com/encorexin/WordPressCMS | e48095be08e5ebd564910970a0921b184fd934b1 | github |
azhu0001/localsend-harmony | serve/src/main/ets/http/ContentType.ets | arkts | getEncoding | 返回content-type中的编码方式 | public getEncoding(): string {
return !this.encoding ? this.asciiEncoding : this.encoding;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEncoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public getEncoding(): string {
return !this.encoding ? this.asciiEncoding : this.encoding;
} | https://gitcode.com/azhu0001/localsend-harmony | c9d75d550b959d3750f90132f9cee163bc1be59e | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Process.ets | arkts | kill | Send a signal to the child process
@param { int | string } signal int or string indicating a kill signal | kill(signal: int | string): void {
let killSignal: int;
if (signal instanceof string) {
if (SIGNAL_MAP.has(signal as string)) {
killSignal = SIGNAL_MAP.get(signal as string)! as int;
} else {
killSignal = SIGNAL_MAP.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left kill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left signal AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Rig... | kill(signal: int | string): void {
let killSignal: int;
if (signal instanceof string) {
if (SIGNAL_MAP.has(signal as string)) {
killSignal = SIGNAL_MAP.get(signal as string)! as int;
} else {
killSignal = SIGNAL_MAP.... | https://gitcode.com/iop123123/arkts-static-skills | e7cbe306aef1ac627a77714b42900e576499e53f | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitInt32 | ========== 标量字段 ==========
访问 int32 字段
JSON: number | visitInt32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitInt32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST... | visitInt32(value: number, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 5685b0423fbb3a15c112f54c289fe56119d70063 | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/ClassService.ets | arkts | getClassTableYjspt | ==================== 研究生 (yjspt) API ==================== | async getClassTableYjspt(semCode: string, sid: string): Promise<string> {
const cas = CasLoginService.getInstance();
const http = HttpUtil.getInstance();
await cas.navigateToYjspt(
'https://yjspt.xidian.edu.cn/gsapp/sys/wdkbapp/*default/index.do#/xskcb');
const now: Date = new Date();
const ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getClassTableYjspt AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left semCode AST#identifier#Right AST#type_annotation#Left AST#:#... | async getClassTableYjspt(semCode: string, sid: string): Promise<string> {
const cas = CasLoginService.getInstance();
const http = HttpUtil.getInstance();
await cas.navigateToYjspt(
'https://yjspt.xidian.edu.cn/gsapp/sys/wdkbapp/*default/index.do#/xskcb');
const now: Date = new Date();
const ... | https://github.com/PollenWang6/HiXD | 9fb0796bb2dc8b21592994b94d31b98a22a6be6c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets | arkts | delete | Removes an Entry with specified key from the Map
@param key the key to remove | delete(key: K): boolean {
const bucketIdx = this.getBucketIndex(key)
let bucket = this.getBucketByIdx(bucketIdx)
let prev: At = 0
while (isLegalAt(bucket)) {
if (Map.sameValueZero(getKeyAt<K>(this.data, bucket), key)) {
if (isLegalAt(prev)) {
... | AST#program#Left AST#ERROR#Left AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left K AST#type_identifier#Right AST#type_annotation#... | delete(key: K): boolean {
const bucketIdx = this.getBucketIndex(key)
let bucket = this.getBucketByIdx(bucketIdx)
let prev: At = 0
while (isLegalAt(bucket)) {
if (Map.sameValueZero(getKeyAt<K>(this.data, bucket), key)) {
if (isLegalAt(prev)) {
... | https://gitcode.com/iop123123/arkts-static-skills | f306e2356de040e9860450d622584f099275e506 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RomParser.ets | arkts | getRegionFromGameCode | 从游戏代码推断区域 | function getRegionFromGameCode(gameCode: string): RomRegion {
if (gameCode.length < 4) return RomRegion.UNKNOWN;
const regionChar = gameCode.charAt(3);
switch (regionChar) {
case 'J': return RomRegion.JAPAN;
case 'E': return RomRegion.USA;
case 'P': return RomRegion.EUROPE;
case 'D': return RomRe... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getRegionFromGameCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gameCode AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | function getRegionFromGameCode(gameCode: string): RomRegion {
if (gameCode.length < 4) return RomRegion.UNKNOWN;
const regionChar = gameCode.charAt(3);
switch (regionChar) {
case 'J': return RomRegion.JAPAN;
case 'E': return RomRegion.USA;
case 'P': return RomRegion.EUROPE;
case 'D': return RomRe... | https://github.com/richshaw2015/nds | 06dd8d4963d681e2016d573aad7108f5dc533659 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.