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 |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | fallbackDeviceTypeDetection | 备用设备类型检测(基于屏幕尺寸) | private fallbackDeviceTypeDetection(): DeviceType {
if (!this.displayObj) {
return DeviceType.PHONE;
}
const density = this.displayObj.densityDPI / 160;
const widthVp = this.displayObj.width / density;
const heightVp = this.displayObj.height / density;
// Use short edge to avoid mis... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fallbackDeviceTypeDetection 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#identif... | private fallbackDeviceTypeDetection(): DeviceType {
if (!this.displayObj) {
return DeviceType.PHONE;
}
const density = this.displayObj.densityDPI / 160;
const widthVp = this.displayObj.width / density;
const heightVp = this.displayObj.height / density;
// Use short edge to avoid mis... | https://github.com/DaLongZhuaZi/manxia | 4f25d452c7fa76235e9498c862ff9638ce180cea | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/GradientBackgroundViewModel.ets | arkts | getNormalGradientItems | 获取普通渐变背景列表
@returns {GradientBackgroundItem[]} 渐变背景数组 | getNormalGradientItems(): GradientBackgroundItem[] {
return [
new GradientBackgroundItem("Red", "红色渐变", TnGradientBackground("red"), "red"),
new GradientBackgroundItem("Red Light", "红色浅色渐变", TnGradientBackground("red-light"), "red-light"),
new GradientBackgroundItem("Red Single", "红色单色渐变", TnGra... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNormalGradientItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left GradientBackgroundItem A... | getNormalGradientItems(): GradientBackgroundItem[] {
return [
new GradientBackgroundItem("Red", "红色渐变", TnGradientBackground("red"), "red"),
new GradientBackgroundItem("Red Light", "红色浅色渐变", TnGradientBackground("red-light"), "red-light"),
new GradientBackgroundItem("Red Single", "红色单色渐变", TnGra... | https://github.com/codelably/tuniao-ui | 44bcaeb13472158de8de3e807d25999182a2a8ca | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/presentation/qrcode/components/ErrorStyleQRCode.ets | arkts | aboutToDisappear | Always clean up asynchronous tasks when the component is destroyed | aboutToDisappear(): void {
this.clearTimer();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
this.clearTimer();
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 53f3f7345155208f1768bc08b7f8727c238c4456 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DeviceManager.ets | arkts | updateDeviceStatus | 更新设备状态
@param status 设备状态 | public updateDeviceStatus(status: DeviceStatus): void {
this.deviceStatuses.set(status.deviceId, status);
// 通知订阅者
const callbacks = this.subscribers.get(status.deviceId);
if (callbacks) {
callbacks.forEach(callback => callback(status));
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateDeviceStatus 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#... | public updateDeviceStatus(status: DeviceStatus): void {
this.deviceStatuses.set(status.deviceId, status);
// 通知订阅者
const callbacks = this.subscribers.get(status.deviceId);
if (callbacks) {
callbacks.forEach(callback => callback(status));
}
} | https://github.com/LJ666-ui/harmony-health-care | f2ddce59d968353baff28d1275c1aee5b2862a80 | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/common/utils/Logger.ets | arkts | constructor | constructor.
@param Prefix identifies the log tag.
@param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. | constructor(prefix: string = 'AlarmClock', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | 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 prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#L... | constructor(prefix: string = 'AlarmClock', domain: number = 0xFF00) {
this.prefix = prefix;
this.domain = domain;
} | https://gitee.com/harmonyos/codelabs.git | e092f141034d0c1b6403d0764aa790d9fa95cbb5 | gitee |
openharmony-sig/FastBle | library/src/main/ets/BleManager.ets | arkts | isBlueEnable | judge Bluetooth is enable
@return | public isBlueEnable(): boolean {
if (BleManager.MOCK_DEVICE) {
return true;
}
return access.getState() == access.BluetoothState.STATE_ON;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isBlueEnable 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#... | public isBlueEnable(): boolean {
if (BleManager.MOCK_DEVICE) {
return true;
}
return access.getState() == access.BluetoothState.STATE_ON;
} | https://gitee.com/openharmony-sig/FastBle.git | 0d0cc92f976fcd1e8cf565c07e906991daa3ea0b | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | of | Creates a new Float64Array using initializer
@param data initializer
@returns a new Float64Array from data | public of(data: Object[]): Float64Array {
throw new Error("Float64Array.of: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public of(data: Object[]): Float64Array {
throw new Error("Float64Array.of: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | edce638181c226edf566b94c51f44e0313c2fda2 | gitee |
zcg741/chengyu-game | entry/src/main/ets/pages/DailyChallengePage.ets | arkts | getInputPlaceholder | 获取输入框提示文字 | getInputPlaceholder(): string {
if (this.todayType === QUESTION_TYPE.EXPLANATION) {
return '请输入成语(根据释义猜测)';
} else if (this.todayType === QUESTION_TYPE.PINYIN) {
return '请输入成语(根据拼音猜测)';
} else if (this.todayType === QUESTION_TYPE.FILL_BLANK) {
return '请输入完整成语(补全填空)';
} else if (this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInputPlaceholder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#st... | getInputPlaceholder(): string {
if (this.todayType === QUESTION_TYPE.EXPLANATION) {
return '请输入成语(根据释义猜测)';
} else if (this.todayType === QUESTION_TYPE.PINYIN) {
return '请输入成语(根据拼音猜测)';
} else if (this.todayType === QUESTION_TYPE.FILL_BLANK) {
return '请输入完整成语(补全填空)';
} else if (this.... | https://github.com/zcg741/chengyu-game | 76dd5e7aed2489374a9d6a7004a7793e3a8ca5bf | github |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/SettingsUtil.ets | arkts | getThemeColor | 获取主题颜色 | static getThemeColor(): string {
return AppStorage.get<string>(STORAGE_KEYS.THEME_COLOR) || DEFAULT_THEME_COLOR;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getThemeColor 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... | static getThemeColor(): string {
return AppStorage.get<string>(STORAGE_KEYS.THEME_COLOR) || DEFAULT_THEME_COLOR;
} | https://github.com/Coke0807/NewsAPP-HarmonyOS | 003223c2bcb67a94e53f7430e5c79160768210b7 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/SessionView.ets | arkts | zoomOut | Zoom out | zoomOut(): void {
this.setViewScale(this.viewScale / 1.25);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left zoomOut AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | zoomOut(): void {
this.setViewScale(this.viewScale / 1.25);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 36ad3a2fef8c7b273d6eb93e0c6514566527cb80 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/model/RemoteHost.ets | arkts | getValidationErrors | 获取验证错误信息 | getValidationErrors(): string[] {
const errors: string[] = [];
if (!this.label) { errors.push('主机名称不能为空'); }
if (this.protocol === 'rustdesk') {
if (!this.customHostname) { errors.push('远程ID不能为空'); }
} else {
if (!this.host) { errors.push('主机地址不能为空'); }
if (!this.username && !this.rd... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getValidationErrors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | getValidationErrors(): string[] {
const errors: string[] = [];
if (!this.label) { errors.push('主机名称不能为空'); }
if (this.protocol === 'rustdesk') {
if (!this.customHostname) { errors.push('远程ID不能为空'); }
} else {
if (!this.host) { errors.push('主机地址不能为空'); }
if (!this.username && !this.rd... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 18c9121f5513e86f4135771a893cf6bc3606b271 | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | generateMultipleSnowballContexts | 生成多个滚雪球语境 | async generateMultipleSnowballContexts(
targetWord: string,
count: number = 3,
style: ContextStyle = ContextStyle.CONVERSATIONAL,
difficulty: DifficultyLevel = DifficultyLevel.CET6
): Promise<SnowballResult[]> {
const results: SnowballResult[] = [];
for (let i = 0; i < count; i++) {
c... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left generateMultipleSnowballContexts AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left targetWord AST#identifier#Right AST#type_annot... | async generateMultipleSnowballContexts(
targetWord: string,
count: number = 3,
style: ContextStyle = ContextStyle.CONVERSATIONAL,
difficulty: DifficultyLevel = DifficultyLevel.CET6
): Promise<SnowballResult[]> {
const results: SnowballResult[] = [];
for (let i = 0; i < count; i++) {
c... | https://github.com/CLMC2025/Vignette | d22b8aa2059e65cceb2f66645d383bea2ec84d0c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | toString | Returns a string representation of the matching result.
@returns { String } a string representing the match result
@throws { Error } - When the matching result is empty, throw it.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toString(): String {
if (this.length > 0) {
return super.toString();
}
throw new Error("result is empty")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): String {
if (this.length > 0) {
return super.toString();
}
throw new Error("result is empty")
} | https://gitcode.com/iop123123/arkts-static-skills | 19040697e5411a9c45880a189c10b0251ba89589 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | of | Returns a new array from a set of elements.
@param { FixedArray<long> } items - a set of elements to include in the new array object.
@returns { BigInt64Array } - a new BigInt64Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(...items: FixedArray<long>): BigInt64Array {
let res = new BigInt64Array(items.length.toInt())
res.ofLong(stub.toValueArray(items))
return res
} | 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#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR... | public static of(...items: FixedArray<long>): BigInt64Array {
let res = new BigInt64Array(items.length.toInt())
res.ofLong(stub.toValueArray(items))
return res
} | https://gitcode.com/iop123123/arkts-static-skills | 985afbee167b4d1e9f742feee4209bb78b633173 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets | arkts | values | Returns elements from the ConcurrentSet
@returns { IterableIterator<T> } an iterable of the values in the ConcurrentSet | public override values(): IterableIterator<T> {
return this.elements.keys();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | public override values(): IterableIterator<T> {
return this.elements.keys();
} | https://gitcode.com/iop123123/arkts-static-skills | e1f24e988625d3174d72c5e0b26f7a1cc517248b | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | Ability 创建时 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET)
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate')
// 注册错误管理器
observerId = errorManager.on('error', {
// 应用注册后... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET)
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate')
// 注册错误管理器
observerId = errorManager.on('error', {
// 应用注册后... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 83b2ae1cd68b1959b52751684e45ee19ca118514 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitFixed64 | 访问 fixed64 字段
JSON: string (避免精度丢失) | visitFixed64(value: bigint, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.toString() as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitFixed64 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 bigint AST#identifier#Right AST#,#Left , A... | visitFixed64(value: bigint, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.toString() as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 7a660787c0f476d6e52b7034a01d6c256c176f57 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | shouldUseDoublePage | 判断是否应该使用双页模式(用于漫画阅读器) | public static shouldUseDoublePage(): boolean {
const deviceInfo = ResponsiveLayoutHelper.deviceManager.getDeviceInfo();
// 横屏且屏幕宽度大于800vp时使用双页模式
return deviceInfo.isLandscape && deviceInfo.screenWidth > 800;
} | 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 shouldUseDoublePage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public static shouldUseDoublePage(): boolean {
const deviceInfo = ResponsiveLayoutHelper.deviceManager.getDeviceInfo();
// 横屏且屏幕宽度大于800vp时使用双页模式
return deviceInfo.isLandscape && deviceInfo.screenWidth > 800;
} | https://github.com/DaLongZhuaZi/manxia | d3c7e18e92412611bbf930e69bca76dc7fa4dbdc | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | updatePodcastFetchStatus | 更新播客获取状态(成功/失败) | async updatePodcastFetchStatus(podcastId: string, isFetchFailed: boolean, lastSuccessfulFetch?: number): Promise<void> {
if (!this.rdbStore) return;
try {
const valueBucket: relationalStore.ValuesBucket = {
isFetchFailed: isFetchFailed ? 1 : 0
};
if (lastSuccessfulFetch !== undefine... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updatePodcastFetchStatus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifie... | async updatePodcastFetchStatus(podcastId: string, isFetchFailed: boolean, lastSuccessfulFetch?: number): Promise<void> {
if (!this.rdbStore) return;
try {
const valueBucket: relationalStore.ValuesBucket = {
isFetchFailed: isFetchFailed ? 1 : 0
};
if (lastSuccessfulFetch !== undefine... | https://github.com/pangpang20/antennaPodHM | a432a70fec1ba556ee3bee5ffec10ede88974cee | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Method.ets | arkts | getType | Returns function type of this method
@returns method's {@link MethodType} | public getType(): MethodType {
return this.methodType!
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getType 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 MethodType AST... | public getType(): MethodType {
return this.methodType!
} | https://gitcode.com/iop123123/arkts-static-skills | 68446c275dc0aed382fe101def46e66d9db67089 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/DeviceManager.ets | arkts | getDevicesByRoom | 根据房间ID获取设备列表
@param roomId 房间ID
@returns DeviceInfo[] 设备列表 | public getDevicesByRoom(roomId: string): DeviceInfo[] {
const deviceIds = this.roomToDeviceMap.get(roomId) || [];
return deviceIds
.map(id => this.devices.get(id))
.filter(device => device !== undefined) as DeviceInfo[];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDevicesByRoom 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#Le... | public getDevicesByRoom(roomId: string): DeviceInfo[] {
const deviceIds = this.roomToDeviceMap.get(roomId) || [];
return deviceIds
.map(id => this.devices.get(id))
.filter(device => device !== undefined) as DeviceInfo[];
} | https://github.com/LJ666-ui/harmony-health-care | 276ab037a60d6c0ef4dae9d1539b0d73aff2a2fc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | addTest | Adds a new test instance to the test suite.
@param {ArkTestBase} test The test instance.
@throws {Error} Thrown when the test name is empty.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private final addTest(test: ArkTestBase): void {
if (test.name == "") {
throw new Error("Test with empty name is not allowed");
}
test.setSuite(this);
this.tests.push(test);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left addTest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left test AST#identifier#Right AST#:#Left : AST#:#... | private final addTest(test: ArkTestBase): void {
if (test.name == "") {
throw new Error("Test with empty name is not allowed");
}
test.setSuite(this);
this.tests.push(test);
} | https://gitcode.com/iop123123/arkts-static-skills | 2487fee00ee23d540cde930b7ee80c8c7a1a7d6c | gitcode |
Vincent-Leon/zotero-harmony | entry/src/main/ets/data/ItemRepository.ets | arkts | upsertItems | ---- items ---- | async upsertItems(items: ZoteroItem[]): Promise<void> {
if (items.length === 0) {
return;
}
const buckets: relationalStore.ValuesBucket[] = [];
const cachedAt: number = Date.now();
for (const item of items) {
buckets.push(itemToBucket(item, cachedAt));
}
try {
// ON_CONFL... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left upsertItems AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left items AST#identifier#Right AST#ty... | async upsertItems(items: ZoteroItem[]): Promise<void> {
if (items.length === 0) {
return;
}
const buckets: relationalStore.ValuesBucket[] = [];
const cachedAt: number = Date.now();
for (const item of items) {
buckets.push(itemToBucket(item, cachedAt));
}
try {
// ON_CONFL... | https://github.com/Vincent-Leon/zotero-harmony | 362a643cd2fae0df79ea95945a75a277c0c6f858 | github |
openharmony/update_update_app | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | onReceivedUpdatePageMessage | 收到page推送消息
@param otaStatus 状态数据 | async onReceivedUpdatePageMessage(otaStatus: OtaStatus): Promise<void> {
this.log('receives from onReceivedUpdatePageMessage:' + JSON.stringify(otaStatus));
this.notifyUpdateStatus(otaStatus, globalThis.abilityContext);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onReceivedUpdatePageMessage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identi... | async onReceivedUpdatePageMessage(otaStatus: OtaStatus): Promise<void> {
this.log('receives from onReceivedUpdatePageMessage:' + JSON.stringify(otaStatus));
this.notifyUpdateStatus(otaStatus, globalThis.abilityContext);
} | https://gitee.com/openharmony/update_update_app.git | f4e16e6639ea283b8be7ac2972c195cb598f0391 | gitee |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/FilterRuleEngine.ets | arkts | shouldIgnoreFile | 文件路径是否应被忽略(匹配任一模式) | static shouldIgnoreFile(filePath: string, patterns: string[]): boolean {
if (!patterns || patterns.length === 0) return false;
for (const pattern of patterns) {
if (FilterRuleEngine.matchesGlob(filePath, pattern)) return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shouldIgnoreFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static shouldIgnoreFile(filePath: string, patterns: string[]): boolean {
if (!patterns || patterns.length === 0) return false;
for (const pattern of patterns) {
if (FilterRuleEngine.matchesGlob(filePath, pattern)) return true;
}
return false;
} | https://github.com/XJTUWYD/ArkDiff | 1a47a17f79ca731257db589ff67b2188ecd707cd | github |
PollenWang6/HiXD | entry/src/main/ets/services/AttendanceModels.ets | arkts | getRemainAbsence | 还可缺课次数 | getRemainAbsence(): number {
const total: number = this.totalTimes > 0 ? this.totalTimes : (parseInt(this.requiredCheckIn) || 0) * 2;
const timeToError: number = Math.floor(total / 4);
const absenceNum: number = parseInt(this.absenceCount) || 0;
const absenceHours: number = absenceNum * 2;
const r... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRemainAbsence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#state... | getRemainAbsence(): number {
const total: number = this.totalTimes > 0 ? this.totalTimes : (parseInt(this.requiredCheckIn) || 0) * 2;
const timeToError: number = Math.floor(total / 4);
const absenceNum: number = parseInt(this.absenceCount) || 0;
const absenceHours: number = absenceNum * 2;
const r... | https://github.com/PollenWang6/HiXD | 83be947dce6c867be73f585065e20137d36d31cf | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | getHttpUtil | 获取HTTP工具实例 | getHttpUtil(): HttpUtil {
return this.httpUtil;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHttpUtil 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 HttpUtil AST#identifier#Right AST#ERROR#Right AST#... | getHttpUtil(): HttpUtil {
return this.httpUtil;
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 6fd6bacf2933ff7e39d2e1fb45c6e6209a835d63 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | searchBookToBook | 将LegadoSearchBook转换为LegadoBook | private searchBookToBook(searchBook: LegadoSearchBook): LegadoBook {
const book: LegadoBook = {
id: `${searchBook.origin}_${searchBook.bookUrl}`,
origin: searchBook.origin,
originName: searchBook.originName,
bookUrl: searchBook.bookUrl,
name: searchBook.name,
author: searchBook... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left searchBookToBook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left searchBook AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private searchBookToBook(searchBook: LegadoSearchBook): LegadoBook {
const book: LegadoBook = {
id: `${searchBook.origin}_${searchBook.bookUrl}`,
origin: searchBook.origin,
originName: searchBook.originName,
bookUrl: searchBook.bookUrl,
name: searchBook.name,
author: searchBook... | https://github.com/DaLongZhuaZi/manxia | 3820693554c3b919cbb9d4a05d11bc1b904aec55 | github |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | setVideoEnabled | 设置视频开关状态
仅通过标志位控制帧是否送入编码器,不触碰摄像头/编码器生命周期。
关闭时:摄像头继续采集但帧在 handleCapturedVideoFrame 入口被丢弃,
同时启动定时器每秒生成带时间戳的占位画面发送给远端
打开时:停止占位画面,恢复帧传递,延迟请求关键帧让远端重新同步 | public async setVideoEnabled(enabled: boolean): Promise<void> {
this.videoSendEnabled = enabled;
if (enabled) {
this.stopPlaceholderTimer();
LogUtil.info('[MediaStream] 视频发送已恢复');
// 恢复后请求关键帧,确保远端能立即解码
setTimeout(() => {
this.requestVideoKeyFrame();
}, 200);
} else {
... | 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 setVideoEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left ... | public async setVideoEnabled(enabled: boolean): Promise<void> {
this.videoSendEnabled = enabled;
if (enabled) {
this.stopPlaceholderTimer();
LogUtil.info('[MediaStream] 视频发送已恢复');
// 恢复后请求关键帧,确保远端能立即解码
setTimeout(() => {
this.requestVideoKeyFrame();
}, 200);
} else {
... | https://github.com/tdcare/tdwebrtc | 1c605721ed3833fb4ac9e3f7f4942ed3bdadbe44 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/ExternalFileOpener.ets | arkts | viewFile | 用默认应用查看文件 | private static async viewFile(filePath: string): Promise<OpenResult> {
const uri = this.toFileUri(filePath);
if (!uri) return { success: false, message: '无法获取文件 URI', filePath };
const want: Want = {
action: 'ohos.want.action.viewData',
uri: uri,
type: '*/*',
};
try {
con... | 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 viewFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifi... | private static async viewFile(filePath: string): Promise<OpenResult> {
const uri = this.toFileUri(filePath);
if (!uri) return { success: false, message: '无法获取文件 URI', filePath };
const want: Want = {
action: 'ohos.want.action.viewData',
uri: uri,
type: '*/*',
};
try {
con... | https://github.com/XJTUWYD/ArkDiff | 5fd6d4d2937bfb948bd7f1b3caba8f37c7640898 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setUseAutoScaleMinRestriction | Sets autoscale restriction for axis min value as enabled/disabled
@Deprecated | public setUseAutoScaleMinRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMin = isEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUseAutoScaleMinRestriction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isEnabled AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left ... | public setUseAutoScaleMinRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMin = isEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7acbc36023895fa43e769962e2d0c5fab7cdaa08 | gitee |
CPF-ApplicationTPC/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | setConnectTimeout | 设置连接超时时长 | setConnectTimeout(timeout: number) {
this.connectTimeout = timeout
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setConnectTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeout AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right ... | setConnectTimeout(timeout: number) {
this.connectTimeout = timeout
} | https://gitcode.com/CPF-ApplicationTPC/ImageKnife/blob/b77b0fbdd908f68c6c5b9baf28a9ca75c07b6d0a/library/src/main/ets/ImageKnife.ets#L65-L67 | 068eb27b48074935d9d8818a442faa2c13d22ed2 | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/model/ConfigInitializer.ets | arkts | isRoutePreloadEnabled | 是否启用路由预加载, 默认为true
@param value | public set isRoutePreloadEnabled(value: boolean) {
this._isRoutePreloadEnabled = value
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left set AST#identifier#Right AST#call_expression#Left AST#identifier#Left isRoutePreloadEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Lef... | public set isRoutePreloadEnabled(value: boolean) {
this._isRoutePreloadEnabled = value
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/ConfigInitializer.ets#L107-L109 | aafafa7f78cafbb590aa4814cda54a0a7f7d73d3 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | getCurrentUserRole | 获取当前用户角色 | getCurrentUserRole(): UserRole | null {
return this.currentUserRole;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentUserRole AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | getCurrentUserRole(): UserRole | null {
return this.currentUserRole;
} | https://github.com/LJ666-ui/harmony-health-care | 062e5c543d3db4917650b173f80c5a0318819764 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/entryability/EntryAbility.ets | arkts | setupMealNotification | 统一设置餐饮通知方法 | private setupMealNotification(
workId: number,
notificationType: string,
title: string,
content: string,
hour: number,
minute: number
): void {
try {
// 计算下一个触发时间
const now = new Date();
const triggerTime = new Date();
triggerTime.setHours(hour, minute, 0, 0);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupMealNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left workId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private setupMealNotification(
workId: number,
notificationType: string,
title: string,
content: string,
hour: number,
minute: number
): void {
try {
// 计算下一个触发时间
const now = new Date();
const triggerTime = new Date();
triggerTime.setHours(hour, minute, 0, 0);
... | https://github.com/chendi126/harmonyOS-TCP | 8f8ed0879a59e1887e2c53a4035fea444a43b3a4 | github |
RoooyHe/toona-ohos | toona/src/main/ets/utils/AppLogger.ets | arkts | debug | DEBUG 级别日志(仅在 debug 构建生效) | debug(msg: string, ...args: object[]): void {
this.logger.debug(this.buildMsg(msg, args));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left debug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ... | debug(msg: string, ...args: object[]): void {
this.logger.debug(this.buildMsg(msg, args));
} | https://github.com/RoooyHe/toona-ohos | 5d54650fbd5fffd0bc00769b04843b34742101ca | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的家庭医生终端系统_韩乐/OpenHarmony_APP/Blood_pressure/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onPageShow | 314fef 9fa6b5 | onPageShow(){
send_once("a10000");
} | 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(){
send_once("a10000");
} | https://gitee.com/openharmony-sig/online_event.git | cf718527cf6e3af5613248955f9f91a7fdf2e6ac | gitee |
honjow/Next2V | shared/src/main/ets/utils/FoldScreenUtil.ets | arkts | getFoldDisplayMode | Get current display mode | getFoldDisplayMode(): display.FoldDisplayMode {
try {
return display.getFoldDisplayMode()
} catch (error) {
console.error('FoldScreenUtil getFoldDisplayMode error:', error)
return display.FoldDisplayMode.FOLD_DISPLAY_MODE_UNKNOWN
}
} | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getFoldDisplayMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | getFoldDisplayMode(): display.FoldDisplayMode {
try {
return display.getFoldDisplayMode()
} catch (error) {
console.error('FoldScreenUtil getFoldDisplayMode error:', error)
return display.FoldDisplayMode.FOLD_DISPLAY_MODE_UNKNOWN
}
} | https://github.com/honjow/Next2V | 8d181e6f056a3b00e2ce555ce7640435194f6c57 | github |
fbinba3955/Flymby | main/src/main/ets/pages/home/media/EmbyEpisodeDetail/index.ets | arkts | changeCurrentEpisodeIndex | 跟踪当前选中集数变化 | changeCurrentEpisodeIndex() {
this.scrollToTargetEpisode()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeCurrentEpisodeIndex 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#statemen... | changeCurrentEpisodeIndex() {
this.scrollToTargetEpisode()
} | https://github.com/fbinba3955/Flymby | f84dfd5924fd108934c994011b0395a9145b1cf4 | github |
xblLab/HarmonyProjectTemplate | components/module_player/src/main/ets/pages/PlayerComponent.ets | arkts | setFullScreen | 设置沉浸式窗口 | setFullScreen(isLayoutFullScreen: boolean) {
window.getLastWindow(getContext(this)).then((win: window.Window) => {
win.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
}).catch(() => {
})
}).catch(() => {
})
this.fullScreen(isLayoutFullScreen)
this.setComponentHeight()
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isLayoutFullScreen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ER... | setFullScreen(isLayoutFullScreen: boolean) {
window.getLastWindow(getContext(this)).then((win: window.Window) => {
win.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
}).catch(() => {
})
}).catch(() => {
})
this.fullScreen(isLayoutFullScreen)
this.setComponentHeight()
... | https://github.com/xblLab/HarmonyProjectTemplate | 985e81f8a041e562c1e0e3552589df950a89192d | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/CityDataService.ets | arkts | initCities | 初始化城市数据(部分热门城市) | static initCities(): void {
if (CityDataService.cities.length > 0) {
return;
}
// 添加热门城市数据
const cityData: CityData[] = [
{ city: "市辖区", province: "北京市", lng: "116.4133836971231", lat: "39.910924547299565" },
{ city: "市辖区", province: "上海市", lng: "121.48053886017651", lat: "31.235929... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left initCities 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#Rig... | static initCities(): void {
if (CityDataService.cities.length > 0) {
return;
}
// 添加热门城市数据
const cityData: CityData[] = [
{ city: "市辖区", province: "北京市", lng: "116.4133836971231", lat: "39.910924547299565" },
{ city: "市辖区", province: "上海市", lng: "121.48053886017651", lat: "31.235929... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | b12a2491f6aa28b59dcb6e1677f0fc57d8e62f06 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/example.ets | arkts | aboutToDisappear | 退出app操作 // | aboutToDisappear(): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio... | aboutToDisappear(): void {} | https://github.com/Nekofox-POT/LinMusic | 356eab6d931df51f0309009ab4ee72bae959a361 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/pages/Index.ets | arkts | updateColors | 更新主题颜色 | updateColors() {
this.colors = getThemeColors();
this.setStatusBarColor();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateColors 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 ... | updateColors() {
this.colors = getThemeColors();
this.setStatusBarColor();
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | bfb6d9b473cd5fe5273fee525ff0d2dfc77cab8f | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | clickInfoToConversation | The SM details page is displayed. | clickInfoToConversation(index) {
if (this.resetTouch()) {
return;
}
// If multiple options are selected, the system responds to CheckBox.
if (this.isMultipleSelectState) {
if (this.messageList[index] == null || this.messageList[index] == undefined) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickInfoToConversation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Righ... | clickInfoToConversation(index) {
if (this.resetTouch()) {
return;
}
// If multiple options are selected, the system responds to CheckBox.
if (this.isMultipleSelectState) {
if (this.messageList[index] == null || this.messageList[index] == undefined) {
... | https://gitee.com/openharmony/applications_mms.git | 4d439030f2a87870c810ce315101a990d5e8f03b | gitee |
2763981847/Clock-Alarm | entry/src/main/ets/viewmodel/WorldClockViewModel.ets | arkts | removeCity | 从城市列表中移除指定索引的城市。
@param indexToRemove 要移除的城市索引 | public removeCity(indexToRemove: number) {
this.cities.splice(indexToRemove, 1)
this.setCitiesToDatabase()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeCity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left indexToRemove AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public removeCity(indexToRemove: number) {
this.cities.splice(indexToRemove, 1)
this.setCitiesToDatabase()
} | https://github.com/2763981847/Clock-Alarm | 5601e19deef09d34ed46c1b02cb7932f5de0aab5 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | fillRoundedRect | 绘制顶部圆角矩形
@param c 画布对象
@param left 矩形左边界的x坐标
@param top 矩形上边界的y坐标
@param width 矩形的宽度
@param height 矩形的高度
@param radius 圆角的半径
@param cornerType 矩形圆角绘制位置类型,顶部/底部/都有 | public static fillRoundedRect(c: CanvasRenderingContext2D, left: number, top: number, width: number, height: number, radius: number, cornerType: RoundCornerType = 'up') {
if (width == 0 || height == 0) {
return;
}
if (width > height && radius >= width / 2) {
switch (cornerType) {
case ... | 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 fillRoundedRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST... | public static fillRoundedRect(c: CanvasRenderingContext2D, left: number, top: number, width: number, height: number, radius: number, cornerType: RoundCornerType = 'up') {
if (width == 0 || height == 0) {
return;
}
if (width > height && radius >= width / 2) {
switch (cornerType) {
case ... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | bf20de7bd939e92fd4413c13c0033b0b9a831450 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | getRemovedItemIds | 获取删除的条目ID列表 | public getRemovedItemIds(): string[] {
const currIds = new Set(this.currentItems.map(item => item.id));
return this.previousItems
.filter(item => !currIds.has(item.id))
.map(item => item.id);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRemovedItemIds 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 stri... | public getRemovedItemIds(): string[] {
const currIds = new Set(this.currentItems.map(item => item.id));
return this.previousItems
.filter(item => !currIds.has(item.id))
.map(item => item.id);
} | https://github.com/DaLongZhuaZi/manxia | d3b3f6edb3811b421300ecbd7053e2477c47cbd2 | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/database/RdbHelper.ets | arkts | queryAppAccounts | [新增] 查询某人的所有账号记录
@param ownerId 当前登录用户的ID (只查属于这个人的密码) | public queryAppAccounts(ownerId: number): Promise<Array<AppAccount>> {
return new Promise((resolve) => {
if (!this.rdbStore) { resolve([]); return; }
try {
let predicates = new relationalStore.RdbPredicates('APP_ACCOUNT_TABLE');
predicates.equalTo('owner_id', ownerId); // 关键:权限隔离
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryAppAccounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ownerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public queryAppAccounts(ownerId: number): Promise<Array<AppAccount>> {
return new Promise((resolve) => {
if (!this.rdbStore) { resolve([]); return; }
try {
let predicates = new relationalStore.RdbPredicates('APP_ACCOUNT_TABLE');
predicates.equalTo('owner_id', ownerId); // 关键:权限隔离
... | https://gitcode.com/openharmony/codelabs | ad7b5f2296579be472c93ee49c2d8387b13d462d | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/slider/index.ets | arkts | onBgTouch | 背景触摸事件 | onBgTouch(event: TouchEvent){
let touch = event.touches[0]
if(!touch){
return
}
const scope = this.getScopeValue()
let value: number
const width = event.target.area.width as number
const height = event.target.area.height as number
const x = touch.x
const y = touch.y
if(this.reverse){
value = ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBgTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identifier#Righ... | onBgTouch(event: TouchEvent){
let touch = event.touches[0]
if(!touch){
return
}
const scope = this.getScopeValue()
let value: number
const width = event.target.area.width as number
const height = event.target.area.height as number
const x = touch.x
const y = touch.y
if(this.reverse){
value = ... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/slider/index.ets#L226-L286 | 574c063d4fa9f43e2dc2bd9eb0b9970758fcc2c2 | github |
openharmony-sig/flutter_flutter | packages/integration_test/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets | arkts | captureView | Captures a screenshot by drawing the view to a Canvas.
<p> {@code convertFlutterSurfaceToImage} must be called prior to capturing the view,
otherwise the result is an error.
@param activity this is {@link FlutterActivity}.
@param methodChannel the method channel to call into Dart.
@param result the result for the metho... | static captureView(ability: UIAbility, methodChannel: MethodChannel, result: MethodResult): void {
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left captureView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ability AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left U... | static captureView(ability: UIAbility, methodChannel: MethodChannel, result: MethodResult): void {
} | https://gitee.com/openharmony-sig/flutter_flutter.git | 8716a23cb9b08c822ce650d9868d98f66eea5d4a | gitee |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootCodeInjection | 测试通道:want.parameters.bootCode=fullName|branch|path,
HomePage 启动后会读取该值并 push 到 CodeDetailPage,方便对详情页做真机回归。 | private handleBootCodeInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_CODE];
if (typeof raw !== 'string') {
return;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootCodeInjection 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#ident... | private handleBootCodeInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_CODE];
if (typeof raw !== 'string') {
return;
}
... | https://github.com/CarGuo/GSYGithubAppOH | 9eb913fc706c3b97971e79467c4b19847838fdb4 | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | aboutToAppear | component rendering | aboutToAppear() {
this.selected =
this.dataList && this.deduplicate(this.dataList).filter(val => val.selected).sort(this.sortBy());
this.unSelected = this.dataList && this.deduplicate(this.dataList).filter(val => !val.selected).sort(this.sortBy());
this.copySelected = this.selected.slice();
this... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.selected =
this.dataList && this.deduplicate(this.dataList).filter(val => val.selected).sort(this.sortBy());
this.unSelected = this.dataList && this.deduplicate(this.dataList).filter(val => !val.selected).sort(this.sortBy());
this.copySelected = this.selected.slice();
this... | https://gitcode.com/openharmony/arkui_ace_engine | 964584530bd01ada17e6bb6ea86bdeea0bf3d582 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | setLoading | Action: 设置加载状态 | public setLoading(isLoading: boolean): void {
this.setState({ isLoading });
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isLoading AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean... | public setLoading(isLoading: boolean): void {
this.setState({ isLoading });
} | https://github.com/LJ666-ui/harmony-health-care | 690ebd8b6c43c2813899c25ef823a4957afefa48 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | selectSpec | 选择规格
@param {GoodsSpec} spec - 选中的规格 | selectSpec(spec: GoodsSpec): void {
// 如果点击的是已选中的规格,则取消选择
if (this.selectedSpec?.id === spec.id) {
this.selectedSpec = null;
} else {
this.selectedSpec = spec;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectSpec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left spec AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GoodsSpec AST#identifier#Right AST#)#Left ) A... | selectSpec(spec: GoodsSpec): void {
// 如果点击的是已选中的规格,则取消选择
if (this.selectedSpec?.id === spec.id) {
this.selectedSpec = null;
} else {
this.selectedSpec = spec;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 8ee03ae97d1b048cb151e7caa8468754d1690c72 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/common/util/DateFormatUtil.ets | arkts | padding | Zero padding, 2 bits.
@param num Number to be converted.
@return Result after zero padding. | padding(num: string): string {
let length = CommonConstants.PADDING_LENGTH;
for (let len = (num.toString()).length; len < length; len = num.length) {
num = `${CommonConstants.PADDING_STR}${num}`;
}
return num;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left padding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri... | padding(num: string): string {
let length = CommonConstants.PADDING_LENGTH;
for (let len = (num.toString()).length; len < length; len = num.length) {
num = `${CommonConstants.PADDING_STR}${num}`;
}
return num;
} | https://gitee.com/openharmony/codelabs.git | b5841798c2e167b245e8ec534ecf344e7be79581 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/UserManager.ets | arkts | cacheUserInfo | 缓存用户信息到本地 | static async cacheUserInfo(username: string, userInfo: IUser): Promise<void> {
try {
if (!UserManager.dataPreferences) {
return;
}
const usersStr = await UserManager.dataPreferences.get(UserManager.KEY_USERS, '[]') as string;
const users = JSON.parse(usersStr) as IUser[];
c... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left cacheUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left :... | static async cacheUserInfo(username: string, userInfo: IUser): Promise<void> {
try {
if (!UserManager.dataPreferences) {
return;
}
const usersStr = await UserManager.dataPreferences.get(UserManager.KEY_USERS, '[]') as string;
const users = JSON.parse(usersStr) as IUser[];
c... | https://github.com/Harrisonls2004/WaterFlow | a90d148cd5031c831d41232c789c8042f93565ea | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getMarkerPosition | Returns the actual position in pixels of the MarkerView for the given
Highlight object.
@param high
@return | protected getMarkerPosition(high: Highlight): number[] {
return [high.getDrawX(), high.getDrawY()];
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getMarkerPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left high AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | protected getMarkerPosition(high: Highlight): number[] {
return [high.getDrawX(), high.getDrawY()];
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e15a6e7b11a3a443ceb58f85c0bbb67f0b5f5c69 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | notify | Notifies (wakes up) threads that are suspended by the Atomics.wait() calls at the given index.
(index = typedArray.byteOffset + offset * 8)
Note: This method also wakes up threads suspended by the Int32Array Atomics.wait(t32, offset32) calls.
But if and only if 't32' views the same Buffer as 'typedArray' and 'offset32'... | public static notify(typedArray: BigInt64Array, offset: int): long {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, BigInt64Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let buffer = typedArray.buffer
if (buffer instanceof ArrayBuffer) {
return 0
... | 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 notify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray AST#identifier#Right AST#:#Left : AST... | public static notify(typedArray: BigInt64Array, offset: int): long {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, BigInt64Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let buffer = typedArray.buffer
if (buffer instanceof ArrayBuffer) {
return 0
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 64b406b208fb344ee73f28a84a966edca70056d0 | gitee |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/PlaySpeedManager.ets | arkts | isDefaultSpeed | 是否为默认速度 | isDefaultSpeed(speed?: number): boolean {
const checkSpeed = speed ?? this.getCurrentSpeed()
return checkSpeed === PlaySpeedManager.DEFAULT_SPEED
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isDefaultSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left speed AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#iden... | isDefaultSpeed(speed?: number): boolean {
const checkSpeed = speed ?? this.getCurrentSpeed()
return checkSpeed === PlaySpeedManager.DEFAULT_SPEED
} | https://github.com/SMAT-Lab/PhantomRendering | 03dacc2b5fd8c8bd8a5a9fbd1e77c13b4c9d56d4 | github |
honjow/Next2V | shared/src/main/ets/parser/V2exTabParser.ets | arkts | stripNonContent | Remove scripts, styles, and HTML comments so topic-id extraction never picks up `/t/NNN` references
that live in tracking JS or comments rather than the real topic list. | private static stripNonContent(html: string): string {
return (html || '')
.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, ' ')
.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, ' ')
.replace(/<!--[\s\S]*?-->/g, ' ')
} | 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 stripNonContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left... | private static stripNonContent(html: string): string {
return (html || '')
.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, ' ')
.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, ' ')
.replace(/<!--[\s\S]*?-->/g, ' ')
} | https://github.com/honjow/Next2V | e05bddc2a8ff5d195ed6146f04da74a14758b4a5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | big | The big() method creates a string that embeds a string in a <big> element (<big>str</big>),
which causes a string to be displayed in a big font.
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public big(): String{
return this.CreateHTMLString('big', '')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left big 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 big(): String{
return this.CreateHTMLString('big', '')
} | https://gitcode.com/iop123123/arkts-static-skills | 981af80581121ce3c08daf2693634c8a766c9046 | gitcode |
HarmonyOS_Samples/MusicHome | products/tv/src/main/ets/tvability/TvAbility.ets | arkts | onCreate | Persists ability context and logs creation.
@param want Launch want.
@param launchParam Launch parameters. | onCreate(): void {
getAppRuntime().context = this.context;
Logger.info('TvAbility: Ability onCreate');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#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#Lef... | onCreate(): void {
getAppRuntime().context = this.context;
Logger.info('TvAbility: Ability onCreate');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 80b5b99ca554ad25594ae880b6191cbfa9a07c04 | gitcode |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | stopReminderService | 停止提醒服务 | stopReminderService(): void {
this.stopReminderTimer();
this.state.reset();
console.log('提醒服务已停止');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopReminderService 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#statemen... | stopReminderService(): void {
this.stopReminderTimer();
this.state.reset();
console.log('提醒服务已停止');
} | https://gitcode.com/openharmony/codelabs | 86ebf12e5292dd3064aefb0a0a75b53202463702 | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets | arkts | getUserCouponPage | 获取用户优惠券分页
@param {PageRequest} params - 分页参数
@returns {Promise<NetworkResponse<NetworkPageData<Coupon>>>} 优惠券分页数据 | async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Coupon>>> =
await NetworkClient.http.post("market/coupon/user/page", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserCouponPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Coupon>>> =
await NetworkClient.http.post("market/coupon/user/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2f8d66ffd82286821cbcbd4abe315c89477fde14 | github |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/instances/InstanceQueryParams.ets | arkts | parseSearchTextFromQueryMap | try parse search params from queryMap
@param queryMap params map parsed from uri
@param params the object to save parse result | function parseSearchTextFromQueryMap(queryMap: Map<string, string>, params: InstancesQueryParams): void {
let searchText = queryMap.get(KEY_SEARCH_TEXT) as string;
if (isEmptyStr(searchText)) {
return;
}
// decode for chinese search
searchText = decodeURI(searchText);
if (isEmptyStr(searchText)) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseSearchTextFromQueryMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left queryMap AST#identifier#Right AST#type_annotation#Left AST... | function parseSearchTextFromQueryMap(queryMap: Map<string, string>, params: InstancesQueryParams): void {
let searchText = queryMap.get(KEY_SEARCH_TEXT) as string;
if (isEmptyStr(searchText)) {
return;
}
// decode for chinese search
searchText = decodeURI(searchText);
if (isEmptyStr(searchText)) {
... | https://gitee.com/openharmony/applications_calendar_data.git | 852b72dafd96024dd62a47fe1e14f5a2cad02eb0 | gitee |
RoooyHe/toona-ohos | toona/src/main/ets/utils/ToastUtils.ets | arkts | show | 显示 Toast
@param message 内容文字
@param duration 时长(毫秒),默认 2000
@param backgroundColor 背景色(可选)
@param textColor 文字颜色(可选) | static show(message: string, duration?: number, backgroundColor?: ResourceColor, textColor?: ResourceColor): void {
WdkitToast.showToast(message, duration, backgroundColor, textColor);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#s... | static show(message: string, duration?: number, backgroundColor?: ResourceColor, textColor?: ResourceColor): void {
WdkitToast.showToast(message, duration, backgroundColor, textColor);
} | https://github.com/RoooyHe/toona-ohos | e1b9dac8a2ef429cf682d0a129830120f8afe0b8 | github |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | initMemoryCache | 设置自定义的内存缓存
@param newMemoryCache 自定义内存缓存 | initMemoryCache(newMemoryCache: IMemoryCache): void {
this.memoryCache = newMemoryCache
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initMemoryCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newMemoryCache AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left IMemoryCache AST#identifier#Right AST#ERROR#Ri... | initMemoryCache(newMemoryCache: IMemoryCache): void {
this.memoryCache = newMemoryCache
} | https://gitee.com/openharmony-tpc/ImageKnife.git | bba5dd4a8e3811efad86da654958b10c45aa848b | gitee |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/FaceRecPage.ets | arkts | getFaceBoxColor | 获取人脸框颜色 | getFaceBoxColor(): string {
switch (this.currentStatus) {
case FaceRecStatus.SUCCESS:
return '#4CD964'; // 绿色
case FaceRecStatus.FAILED:
return '#FF3B30'; // 红色
case FaceRecStatus.SCANNING:
case FaceRecStatus.VERIFYING:
return '#007AFF'; // 蓝色
case FaceRecStat... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFaceBoxColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getFaceBoxColor(): string {
switch (this.currentStatus) {
case FaceRecStatus.SUCCESS:
return '#4CD964'; // 绿色
case FaceRecStatus.FAILED:
return '#FF3B30'; // 红色
case FaceRecStatus.SCANNING:
case FaceRecStatus.VERIFYING:
return '#007AFF'; // 蓝色
case FaceRecStat... | https://gitcode.com/openharmony/codelabs | 5361165be2c96d6214809065d7e4a9f20864ed02 | gitcode |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/AvPlayManager.ets | arkts | getAudioTrack | 获取视频多音轨列表 | async getAudioTrack(): Promise<void> {
if (this.avPlayer) {
this.avPlayer.getTrackDescription().then((arrList: Array<media.MediaDescription>) => {
Logger.info('getTrackDescription success');
Logger.info(this.tag, 'get AudioTrackList: ' + arrList.length);
if (this.arrList.length === 0... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAudioTrack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left A... | async getAudioTrack(): Promise<void> {
if (this.avPlayer) {
this.avPlayer.getTrackDescription().then((arrList: Array<media.MediaDescription>) => {
Logger.info('getTrackDescription success');
Logger.info(this.tag, 'get AudioTrackList: ' + arrList.length);
if (this.arrList.length === 0... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 8249831e4b97c3eb173209a122ccfba2e0a757bd | gitee |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/model/EventModel.ets | arkts | queryAll | ========================================================
新增方法 1:查询所有日程 (供 DataExportService 使用)
======================================================== | static async queryAll(): Promise<Event[]> {
let predicates = new relationalStore.RdbPredicates(TABLE_EVENT);
predicates.orderByDesc('start_time');
try {
const resultSet = await RdbHelper.getInstance().query(predicates);
return EventModel.resultSetToEvents(resultSet);
} catch (err) {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left queryAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | static async queryAll(): Promise<Event[]> {
let predicates = new relationalStore.RdbPredicates(TABLE_EVENT);
predicates.orderByDesc('start_time');
try {
const resultSet = await RdbHelper.getInstance().query(predicates);
return EventModel.resultSetToEvents(resultSet);
} catch (err) {
... | https://gitcode.com/openharmony/codelabs | 70c199c44b6068b064717c631ddd68f8e588d9a0 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | deleteEpisodesByPodcastId | 删除指定播客的所有Episodes | async deleteEpisodesByPodcastId(podcastId: string): Promise<void> {
if (!this.rdbStore) return;
try {
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_EPISODE);
predicates.equalTo('podcastId', podcastId);
await this.rdbStore.delete(predicates);
} catch (error) {
... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteEpisodesByPodcastId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifi... | async deleteEpisodesByPodcastId(podcastId: string): Promise<void> {
if (!this.rdbStore) return;
try {
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_EPISODE);
predicates.equalTo('podcastId', podcastId);
await this.rdbStore.delete(predicates);
} catch (error) {
... | https://github.com/pangpang20/antennaPodHM | 8b13f68f992fc64095f9d6b014b89c5ca442bccf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets | arkts | convertToChapters | 批量转换章节 | static convertToChapters(legacyChapters: LegacyChapterInfo[]): Chapter[] {
return legacyChapters.map(ch => this.convertToChapter(ch));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left legacyChapters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | static convertToChapters(legacyChapters: LegacyChapterInfo[]): Chapter[] {
return legacyChapters.map(ch => this.convertToChapter(ch));
} | https://github.com/DaLongZhuaZi/manxia | 80eca0b022f2991cf5a530a852921c1cb6d7c130 | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/utils/CityClockCardUtil.ets | arkts | getHourWest | getHourWest
@param timeZone timeZone
@param cityIndex cityIndex
@returns | public static getHourWest(timeZone: string, cityIndex: string): number {
const calendar = i18n.getCalendar(i18n.System.getSystemLocale());
calendar.setTimeZone(timeZone);
let year = calendar.get(CalendarFiled.Year)
let month = calendar.get(CalendarFiled.Month);
let date = calendar.get(CalendarFile... | 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 getHourWest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeZone AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public static getHourWest(timeZone: string, cityIndex: string): number {
const calendar = i18n.getCalendar(i18n.System.getSystemLocale());
calendar.setTimeZone(timeZone);
let year = calendar.get(CalendarFiled.Year)
let month = calendar.get(CalendarFiled.Month);
let date = calendar.get(CalendarFile... | https://gitee.com/openharmony-sig/applications_clock.git | b1a7a0076d9718940d37b727d5fa0a0fa1f1f346 | gitee |
Jack-TCN/richEditor | src/main/ets/controller/RichEditorController.ets | arkts | onSelectionStyleChange | 选中样式发生变化时调用方法
@param styledKey
@param styledValue | onSelectionStyleChange(styledKey: StyledStringKey, styledValue: StyledStringValue){
let richEditorSelection = this.controller.getSelection();
let start = richEditorSelection.start ? richEditorSelection.start : 0;
let end = richEditorSelection.end ? richEditorSelection.end : 0;
if (start < 0 || end <= ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onSelectionStyleChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left styledKey AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StyledStringK... | onSelectionStyleChange(styledKey: StyledStringKey, styledValue: StyledStringValue){
let richEditorSelection = this.controller.getSelection();
let start = richEditorSelection.start ? richEditorSelection.start : 0;
let end = richEditorSelection.end ? richEditorSelection.end : 0;
if (start < 0 || end <= ... | https://github.com/Jack-TCN/richEditor | 997758fb125dd7c6be1a526236440a8b804f03d8 | github |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaTools.ets | arkts | fill | 日期不足两位补 0
@param {string} value - 数据值
@return {string} - 日期不足两位补 0 | private static fill(value: number): string {
return (value < 10 ? `0${value}` : `${value}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#... | private static fill(value: number): string {
return (value < 10 ? `0${value}` : `${value}`);
} | https://gitee.com/harmonyos/codelabs.git | d4b36541d2abf3ea7d941d380f7a7928c157b512 | gitee |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/media/facades/MediaPickerFacade.ets | arkts | pickDocuments | 调起系统安全的文件选择器 | async pickDocuments(): Promise<Array<string>> {
const context = uiContextManager.getFullAbilityContext();
if (!context) {
logger.error(TAG, '缺少 UIAbilityContext');
return [];
}
try {
// 鸿蒙 4.0 以后推荐使用 @ohos.file.picker
const documentSelectOptions = new picker.DocumentSelectOpti... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pickDocuments 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 pickDocuments(): Promise<Array<string>> {
const context = uiContextManager.getFullAbilityContext();
if (!context) {
logger.error(TAG, '缺少 UIAbilityContext');
return [];
}
try {
// 鸿蒙 4.0 以后推荐使用 @ohos.file.picker
const documentSelectOptions = new picker.DocumentSelectOpti... | https://github.com/DaLongZhuaZi/NGF | c3f506a439b3413406235529be2b89a9529a28a3 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BaseDataSet.ets | arkts | setColorsByArrAndAlpha | Sets colors with a specific alpha value.
@param colors
@param alpha | public setColorsByArrAndAlpha(colors: number[], alpha: number): void {
this.resetColors();
for (let color of colors) {
this.addColor(ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)));
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setColorsByArrAndAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | public setColorsByArrAndAlpha(colors: number[], alpha: number): void {
this.resetColors();
for (let color of colors) {
this.addColor(ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)));
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 684f594eb2b5b92d396e0e883f5c640e0d421a97 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | subarray | Creates a BigUint64Array with the same underlying ArrayBuffer
@param begin start index, inclusive
@param end last index, exclusive
@returns new BigUint64Array with the same underlying ArrayBuffer | public subarray(begin: number, end: number): BigUint64Array {
return this.subarray(begin as int, end as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public subarray(begin: number, end: number): BigUint64Array {
return this.subarray(begin as int, end as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 5d8126125366fec3fca0c87067c62b01ecda4919 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/MessageUtils.ets | arkts | binaryToString | 辅助方法:将 Uint8Array 转换为字符串(用于 Set 比较) | private static binaryToString(binary: Uint8Array): string {
let result = ''
for (let i = 0; i < binary.length; i++) {
result += String.fromCharCode(binary[i])
}
return result
} | 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 binaryToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left binary AST#identifier#Right AST#:#Lef... | private static binaryToString(binary: Uint8Array): string {
let result = ''
for (let i = 0; i < binary.length; i++) {
result += String.fromCharCode(binary[i])
}
return result
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 19192e64b1b9f49a0e1eb1ecba6f6f40c8fabd5b | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/SchoolCardService.ets | arkts | ensureOpenId | 获取校园卡 openid。
手动跟随 OAuth2 重定向链(同 Flutter 做法),确保每步携带对应域名的 Cookie | async ensureOpenId(forceRefresh: boolean = false): Promise<string> {
if (!forceRefresh && this.isOpenIdValid()) {
return this.openid;
}
this.openid = '';
this.openidFetchedAt = 0;
// v8scan OAuth 链: v8scan → xxcapp/uc/api/oauth → xxcapp/uc/wap/login
// → xxcapp/a_xidian/cas-login → i... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left ensureOpenId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left forceRefresh AST#identifier#Righ... | async ensureOpenId(forceRefresh: boolean = false): Promise<string> {
if (!forceRefresh && this.isOpenIdValid()) {
return this.openid;
}
this.openid = '';
this.openidFetchedAt = 0;
// v8scan OAuth 链: v8scan → xxcapp/uc/api/oauth → xxcapp/uc/wap/login
// → xxcapp/a_xidian/cas-login → i... | https://github.com/PollenWang6/HiXD | 1c60e0747877805617b8b570a6683e02a4c762eb | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/AsrDisplayManager.ets | arkts | expand | Expand (show) ASR bubble for a message in this session.
With hidden-set semantics, this means removing from hidden set. | expand(messageID: string | undefined): void {
if (!messageID || messageID.length === 0) {
return;
}
if (this.hiddenMessageIDs.has(messageID)) {
this.hiddenMessageIDs.delete(messageID);
this.version++; // Trigger UI update
console.log(`[AsrDisplayManager] 👁️ Show ASR bubble for mes... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left expand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left messageID AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig... | expand(messageID: string | undefined): void {
if (!messageID || messageID.length === 0) {
return;
}
if (this.hiddenMessageIDs.has(messageID)) {
this.hiddenMessageIDs.delete(messageID);
this.version++; // Trigger UI update
console.log(`[AsrDisplayManager] 👁️ Show ASR bubble for mes... | https://github.com/Tencent-RTC/TUIKit_Harmony | d7db51502545e4ce6b9eef3470376b806e0f5e0c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | get | Gets the float value wrapped in this FloatBox.
@returns { float } The float value wrapped in this FloatBox
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get(): float {
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(): float {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | fa3008074de7cc8ca71b4bd3a859deca86f508db | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | postDetail | 获取帖子详情(含 raw 等字段) | static postDetail(postId: number): string {
return `/posts/${postId}.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left postDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left postId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static postDetail(postId: number): string {
return `/posts/${postId}.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 653ac0cfae161f57dd4ffcf3ef2804469e64dee7 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | checkRestReminder | 检查并触发休息提醒 | checkRestReminder(sportData: SportData): void {
const config = this.settings.getReminderConfig(ReminderType.REST_REMINDER);
if (config && config.enabled && config.durationThreshold) {
const durationMinutes = Math.floor(sportData.duration / 60000);
if (durationMinutes >= config.durationThreshold) {... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkRestReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sportData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SportData AST#identifier#Right AS... | checkRestReminder(sportData: SportData): void {
const config = this.settings.getReminderConfig(ReminderType.REST_REMINDER);
if (config && config.enabled && config.durationThreshold) {
const durationMinutes = Math.floor(sportData.duration / 60000);
if (durationMinutes >= config.durationThreshold) {... | https://gitcode.com/openharmony/codelabs | 16f895854805fa1e7088a5027b39d8d08c8996fa | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/PairingManager.ets | arkts | getClientName | 获取客户端名称(使用设备名称) | private getClientName(): string {
if (PairingManager.cachedClientName) {
return PairingManager.cachedClientName;
}
try {
const name = deviceInfo.marketName || deviceInfo.productModel || 'Moonlight-HarmonyOS';
PairingManager.cachedClientName = name;
return name;
} catch (err) {... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getClientName 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... | private getClientName(): string {
if (PairingManager.cachedClientName) {
return PairingManager.cachedClientName;
}
try {
const name = deviceInfo.marketName || deviceInfo.productModel || 'Moonlight-HarmonyOS';
PairingManager.cachedClientName = name;
return name;
} catch (err) {... | https://github.com/AlkaidLab/moonlight-harmony | cd1f8cfedafb1b9fad32853ad28ceb94de8abbb8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getName | Returns name of type if exists and empty string otherwise
@returns {string} type name
@throws {Error} - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override getName(): string {
return "undefined"
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left getName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public override getName(): string {
return "undefined"
} | https://gitcode.com/iop123123/arkts-static-skills | c25c043722b358037e6a2c170dbe699e0370bd24 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | revertRect | Restore rectangle.
@param rect
@param width
@param height | static revertRect(rect: RectF, width: number, height: number): void {
rect.left *= width;
rect.right *= width;
rect.top *= height;
rect.bottom *= height;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left revertRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RectF... | static revertRect(rect: RectF, width: number, height: number): void {
rect.left *= width;
rect.right *= width;
rect.top *= height;
rect.bottom *= height;
} | https://gitee.com/openharmony/codelabs.git | f97c2e5adeef620cd235466e29db159ab9bea6ce | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRequestQueue.ets | arkts | flushQueues | Drop both the request queue and the event queue. Started timed events are
intentionally preserved. Use with caution, pending telemetry is lost. | public async flushQueues(): Promise<void> {
if (this.rejectIfHalted('ModuleRequestQueue', 'flushQueues')) return;
this.eventsModule.clearEventQueue();
await this.core.requestQueue.clear();
} | 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 flushQueues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public async flushQueues(): Promise<void> {
if (this.rejectIfHalted('ModuleRequestQueue', 'flushQueues')) return;
this.eventsModule.clearEventQueue();
await this.core.requestQueue.clear();
} | https://github.com/Countly/countly-sdk-hos | cba11cc8b675d99456d699d42d290a19857d991c | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | updatePerformanceStats | 更新性能统计 | private updatePerformanceStats(): void {
// 更新缓存统计
const cacheStats = this.frameCacheManager.getCacheStats()
this.stats.cacheHitRate = cacheStats.hitRate
this.stats.memoryUsage = cacheStats.size / (1024 * 1024) // MB
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updatePerformanceStats 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 vo... | private updatePerformanceStats(): void {
// 更新缓存统计
const cacheStats = this.frameCacheManager.getCacheStats()
this.stats.cacheHitRate = cacheStats.hitRate
this.stats.memoryUsage = cacheStats.size / (1024 * 1024) // MB
} | https://github.com/AetheriumSimulator/qemu-hmos | 268c426566eee8655e61aee26b28bb764bbb646c | github |
openharmony-sig/applications_filemanager | entry/src/main/ets/view/DeviceDialog.ets | arkts | build | 经实际测试,这里似乎写不写后面的传参类型都可以 | build() {
Column() {
Text($r('app.string.choiceDevice'))
.fontSize(30)
.width('100%')
.fontColor(Color.Black)
.textAlign(TextAlign.Start)
.fontWeight(FontWeight.Bold)
List() {
ForEach(this.deviceLists, (item, index) => {
ListItem() {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Text($r('app.string.choiceDevice'))
.fontSize(30)
.width('100%')
.fontColor(Color.Black)
.textAlign(TextAlign.Start)
.fontWeight(FontWeight.Bold)
List() {
ForEach(this.deviceLists, (item, index) => {
ListItem() {
... | https://gitee.com/openharmony-sig/applications_filemanager.git | 0ab9642071b23b0b7dd20a4e471568fd3e494dc1 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | notifyFontChange | 通知字体变更 | private notifyFontChange(scene: FontScene): void {
const fontFamily = this.getFontFamily(scene);
// 同步到AppStorage
this.syncToAppStorage();
this.callbacks.forEach((callback) => {
try {
callback(scene, fontFamily);
} catch (error) {
logger.error(TAG, `字体变更回调执行失败: ${... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyFontChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private notifyFontChange(scene: FontScene): void {
const fontFamily = this.getFontFamily(scene);
// 同步到AppStorage
this.syncToAppStorage();
this.callbacks.forEach((callback) => {
try {
callback(scene, fontFamily);
} catch (error) {
logger.error(TAG, `字体变更回调执行失败: ${... | https://github.com/DaLongZhuaZi/manxia | 5577f0aea156798a2dff94e4308a41cd000facd7 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/AxisRenderer.ets | arkts | computeAxis | Computes the axis values.
@param min - the minimum value in the data object for this axis
@param max - the maximum value in the data object for this axis | public computeAxis(min: number, max: number, inverted: boolean, customYAxisLabels?: number[]) {
// calculate the starting and entry point of the y-labels (depending on
// zoom / contentrect bounds)
if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mView... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left computeAxis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | public computeAxis(min: number, max: number, inverted: boolean, customYAxisLabels?: number[]) {
// calculate the starting and entry point of the y-labels (depending on
// zoom / contentrect bounds)
if (this.mTrans && this.mViewPortHandler != null && this.mViewPortHandler.contentWidth() > 10 && !this.mView... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1c3f7caf2b42a3ffcf306a7a5718ff353e1b979e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | updateOnlineComicSourceNameByExternalId | 根据外部ID更新在线漫画的sourceName | public async updateOnlineComicSourceNameByExternalId(externalId: string, sourceName: string): Promise<void> {
try {
const sql = 'UPDATE online_comic_info SET sourceName = ?, updateTime = ? WHERE externalId = ?';
await this.databaseManager.executeSql(sql, [sourceName, Date.now(), externalId]);
lo... | 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 updateOnlineComicSourceNameByExternalId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left externalId AST#identifier#Right... | public async updateOnlineComicSourceNameByExternalId(externalId: string, sourceName: string): Promise<void> {
try {
const sql = 'UPDATE online_comic_info SET sourceName = ?, updateTime = ? WHERE externalId = ?';
await this.databaseManager.executeSql(sql, [sourceName, Date.now(), externalId]);
lo... | https://github.com/DaLongZhuaZi/manxia | 82932beb4e093f2d47aaf19118bcde0943f01f80 | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/pages/StarMapPage.ets | arkts | wobbleY | 计算节点的视觉垂直偏移(idle wobble),不修改 node.y。
Y 方向频率略低(0.7x)、振幅更小(0.6x),营造自然漂浮感。 | wobbleY(nodeId: string, tick: number): number {
if (!this.motionEnabled || !this.idleWobbleEnabled || this.reduceMotion || this.draggingNodeId === nodeId) {
return 0
}
const phase = this.stablePhase(nodeId)
const period = this.idlePeriodMs
const amplitude = this.idleAmplitudeVp
return Ma... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left wobbleY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,... | wobbleY(nodeId: string, tick: number): number {
if (!this.motionEnabled || !this.idleWobbleEnabled || this.reduceMotion || this.draggingNodeId === nodeId) {
return 0
}
const phase = this.stablePhase(nodeId)
const period = this.idlePeriodMs
const amplitude = this.idleAmplitudeVp
return Ma... | https://github.com/Xiwei753/xiezuoruanjian | 715f0afe4d7fa525a0747b4da4a7d3d5dd4e8cfa | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncCondVarBasedMutex.ets | arkts | notifyOne | Unblocks ONE suspended coroutine associated with this CondVar, if it exists.
@returns { void } No return value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel
pre-condition: mutex is locked.
post-condition: mutex is locked. | public notifyOne(): void {
if (this.waiters_ != 0) {
this.waitersList_.resume();
this.waiters_--;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyOne 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_s... | public notifyOne(): void {
if (this.waiters_ != 0) {
this.waitersList_.resume();
this.waiters_--;
}
} | https://gitcode.com/iop123123/arkts-static-skills | 4291de8086c971210dbefb2a09272c7615dfa5ed | gitcode |
openharmony/arkui_ace_engine | examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets | arkts | testGetAnimationControllerWithId | ===================== AnimationController 测试 ===================== | testGetAnimationControllerWithId() {
this.addLog('=== Test: AnimatedDrawableDescriptor.getAnimationController(id) ===');
try {
const anim = new AnimatedDrawableDescriptor($r('app.media.flower'), {
duration: 2000,
iterations: 1,
autoPlay: false,
});
this.animatedFromRe... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left testGetAnimationControllerWithId 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#s... | testGetAnimationControllerWithId() {
this.addLog('=== Test: AnimatedDrawableDescriptor.getAnimationController(id) ===');
try {
const anim = new AnimatedDrawableDescriptor($r('app.media.flower'), {
duration: 2000,
iterations: 1,
autoPlay: false,
});
this.animatedFromRe... | https://gitcode.com/openharmony/arkui_ace_engine | c8a78e5cc5a23f69c0a5cad969d6b9d5ce9edb0e | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | remove | Removes the first occurrence of an element from the list.
@param element The element to remove.
@returns True if the element was removed successfully. | public remove(element: T): boolean {
return this.buffer.remove(element);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right... | public remove(element: T): boolean {
return this.buffer.remove(element);
} | https://gitcode.com/iop123123/arkts-static-skills | b414c00b4a07fa1249ec56c2b3287262a2fcb41f | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getString | 获取字符串结果
支持规则分割符: && (与), || (或), %% (交叉合并) | getString(ruleStr: string | undefined): string {
if (!ruleStr || ruleStr.trim() === '') {
return '';
}
try {
const processedRule = this.preprocessRuleText(ruleStr);
// 处理规则分割符
const splitResult = this.splitRuleStr(processedRule);
if (splitResult.rules.length > 1) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ruleStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left string AST#ident... | getString(ruleStr: string | undefined): string {
if (!ruleStr || ruleStr.trim() === '') {
return '';
}
try {
const processedRule = this.preprocessRuleText(ruleStr);
// 处理规则分割符
const splitResult = this.splitRuleStr(processedRule);
if (splitResult.rules.length > 1) {
... | https://github.com/DaLongZhuaZi/manxia | 8f19218405693f729b81e370a7f8dc50fef08db0 | github |
lidaixian999/Smart_Car | entry/src/main/ets/pages/Index.ets | arkts | tabBarBuilder | 传入标题title,页签数据targetIndex,选中状态的图标selectIcon,未选中状态的图标unselectIcon | tabBarBuilder(title: string, targetIndex: number, selectedIcon: Resource, unselectIcon: Resource) {
Column() {
//currentIndex为状态变量保证页签与图标实时刷新
Image(this.currentIndex === targetIndex ? selectedIcon : unselectIcon)
.width(24)
.height(24)
Text(title)//字体
.fontFamily('Harmony... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tabBarBuilder 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#Righ... | tabBarBuilder(title: string, targetIndex: number, selectedIcon: Resource, unselectIcon: Resource) {
Column() {
//currentIndex为状态变量保证页签与图标实时刷新
Image(this.currentIndex === targetIndex ? selectedIcon : unselectIcon)
.width(24)
.height(24)
Text(title)//字体
.fontFamily('Harmony... | https://github.com/lidaixian999/Smart_Car | 8121185a564b16dda85206334c4165e21c0caaca | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ImageGenerationRcpClient.ets | arkts | getSession | 复用 session 实现连接池效果 | private getSession(): rcp.Session {
if (this.session === null) {
try {
this.session = rcp.createSession({
connectionConfiguration: {
maxConnectionsPerHost: 6,
maxTotalConnections: 32
},
requestConfiguration: {
transfer: {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSession 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#member_expression#Left A... | private getSession(): rcp.Session {
if (this.session === null) {
try {
this.session = rcp.createSession({
connectionConfiguration: {
maxConnectionsPerHost: 6,
maxTotalConnections: 32
},
requestConfiguration: {
transfer: {
... | https://github.com/LongLiveY96/chatcube | 1e6ba3907e4372790eaa7bf85674cc069acf3caa | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.