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 |
|---|---|---|---|---|---|---|---|---|---|---|
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/pages/Minesweeper.ets | arkts | aboutToDisappear | 组件销毁时清除定时器和移除主题监听器 | aboutToDisappear(): void {
// 清除定时器
if (this.timerId !== -1) {
clearInterval(this.timerId);
this.timerId = -1;
}
// 注意:在实际应用中,应该保存监听器的引用以便移除
// 这里为了简化,暂时不实现移除逻辑
} | 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 {
// 清除定时器
if (this.timerId !== -1) {
clearInterval(this.timerId);
this.timerId = -1;
}
// 注意:在实际应用中,应该保存监听器的引用以便移除
// 这里为了简化,暂时不实现移除逻辑
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 35c7010f4c9a5bb789c12a48eb8ed81c2902c990 | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | clearAllUnknownWords | 清空所有未知词汇 | clearAllUnknownWords(): void {
this.unknownWords.clear();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAllUnknownWords 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#stateme... | clearAllUnknownWords(): void {
this.unknownWords.clear();
} | https://github.com/CLMC2025/Vignette | 8ec751d1323b1663997d9df54327b7a558e0afff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Authentication/LoginManager.ets | arkts | loginWithOAuth | OAuth登录 | private async loginWithOAuth(
sourceId: number,
config: OAuthLoginConfig
): Promise<LoginResult> {
logger.info(TAG, `OAuth登录: ${config.authUrl}`);
// OAuth登录需要打开浏览器,这里返回配置
return {
success: false,
message: 'OAuth登录需要在浏览器中完成'
};
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loginWithOAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async loginWithOAuth(
sourceId: number,
config: OAuthLoginConfig
): Promise<LoginResult> {
logger.info(TAG, `OAuth登录: ${config.authUrl}`);
// OAuth登录需要打开浏览器,这里返回配置
return {
success: false,
message: 'OAuth登录需要在浏览器中完成'
};
} | https://github.com/DaLongZhuaZi/manxia | 3f3c72ee9f583839401e29ed4934bf5ba8a398d6 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AnomalyDetection.ets | arkts | detectFrequencyAnomaly | 检测账单频率异常
@param bills 账单列表
@param windowDays 时间窗口天数 | static detectFrequencyAnomaly(bills: Bill[], windowDays: number = 7): AnomalyDetectionResult {
// 按日期分组统计每日账单数
const dailyCounts: Map<string, number> = new Map();
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.isDeleted === 0 && bill.type === 'expense') {
con... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectFrequencyAnomaly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscrip... | static detectFrequencyAnomaly(bills: Bill[], windowDays: number = 7): AnomalyDetectionResult {
// 按日期分组统计每日账单数
const dailyCounts: Map<string, number> = new Map();
for (let i = 0; i < bills.length; i++) {
const bill = bills[i];
if (bill.isDeleted === 0 && bill.type === 'expense') {
con... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a5e98ea45d7732cf4a3977b4788a1efc1cef538d | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test8_original_index.ets | arkts | testObjectKeys | --- Object.keys / values --- | function testObjectKeys(): string {
let obj: Record<string, number> = {};
obj['x'] = 1;
obj['y'] = 2;
obj['z'] = 3;
let keys: string[] = Object.keys(obj);
return keys.join(',');
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectKeys AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testObjectKeys(): string {
let obj: Record<string, number> = {};
obj['x'] = 1;
obj['y'] = 2;
obj['z'] = 3;
let keys: string[] = Object.keys(obj);
return keys.join(',');
} | https://github.com/miaochiahao/ark-ghidra | f04ba6f25241c06bf483e0fe6d3383629870d092 | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/common/ImageCropperController.ets | arkts | cropAspectRatio | / Retrieves the current crop aspect ratio.
/ Returns null if not set, or a value greater than 0 if a ratio is applied. | get cropAspectRatio(): number | null {
return this.getActionDetails().cropAspectRatio;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left cropAspectRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#iden... | get cropAspectRatio(): number | null {
return this.getActionDetails().cropAspectRatio;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/common/ImageCropperController.ets#L48-L50 | 42d237e193dfb5c4cb57fbece3c4860814b8937f | github |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/services/LocalDeviceService.ets | arkts | getSelectedLocation | 获取当前选中的位置
@returns string 当前选中位置 | getSelectedLocation(): string {
return this.selectedLocation;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectedLocation 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... | getSelectedLocation(): string {
return this.selectedLocation;
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | 04b6d25e192efaafe253d1ae6867a3365ec6fe67 | gitcode |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/model/HealthConsultFavoriteModel.ets | arkts | getFavoriteSetData | Get or initialize the get all favorite data (in set form). | async getFavoriteSetData(): Promise<Set<number>> {
if (!preference) {
await this.getPreferencesFromStorage();
}
if (this.favoriteData == null) {
try {
this.favoriteData = new Set<number>(await preference.get('FavoriteConsultIds', []) as Array<number>);
} catch (err) {
con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getFavoriteSetData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#L... | async getFavoriteSetData(): Promise<Set<number>> {
if (!preference) {
await this.getPreferencesFromStorage();
}
if (this.favoriteData == null) {
try {
this.favoriteData = new Set<number>(await preference.get('FavoriteConsultIds', []) as Array<number>);
} catch (err) {
con... | https://gitcode.com/openharmony/codelabs | de3b337855dcb620861cde1df4396c4a62bab56b | gitcode |
openharmony-sig/qr-code-generator | library/src/main/ets/components/MainPage/qrcodegen.ets | arkts | reedSolomonMultiply | Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. | private static reedSolomonMultiply(x: byte, y: byte): byte {
if (x >>> 8 != 0 || y >>> 8 != 0)
throw new Error("Byte out of range");
// Russian peasant multiplication
let z: int = 0;
for (let i = 7; i >= 0; i--) {
z = (z << 1) ^ ((z >>> 7) * 0x11D);
z ^= ((y >>> i) & 1)... | 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 reedSolomonMultiply AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Lef... | private static reedSolomonMultiply(x: byte, y: byte): byte {
if (x >>> 8 != 0 || y >>> 8 != 0)
throw new Error("Byte out of range");
// Russian peasant multiplication
let z: int = 0;
for (let i = 7; i >= 0; i--) {
z = (z << 1) ^ ((z >>> 7) * 0x11D);
z ^= ((y >>> i) & 1)... | https://gitee.com/openharmony-sig/qr-code-generator.git | 84ba57e5a09ed7eb98209204944385ed24c30202 | gitee |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/Utils.ets | arkts | radians | / Convert [degrees] to radians. | static radians(degrees: number): number {
return degrees * NumberUtils.degrees2Radians;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left radians AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left degrees AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right A... | static radians(degrees: number): number {
return degrees * NumberUtils.degrees2Radians;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/Utils.ets#L86-L88 | ddd237cb23733963314b731537e7814b537a8287 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array of the same type.
@param { Int16Array } arr - An array to convert to a new array.
@returns { Int16Array } - A new Int16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: Int16Array): Int16Array {
let result = new Int16Array(arr.length)
result.set(arr)
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: Int16Array): Int16Array {
let result = new Int16Array(arr.length)
result.set(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | ceefc47ba849003286860fd02164e317b59054b6 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/skill/utils/SkillTestTool.ets | arkts | testEmergency | 测试紧急意图 | private async testEmergency(): Promise<void> {
const testName = '紧急求助';
const testCases = [
{ input: '救命', expectedContains: ['120', '紧急'] },
{ input: '打120', expectedContains: ['120'] },
{ input: '晕倒了', expectedContains: ['紧急', '120'] }
];
for (const tc of testCases) {
try {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left testEmergency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async testEmergency(): Promise<void> {
const testName = '紧急求助';
const testCases = [
{ input: '救命', expectedContains: ['120', '紧急'] },
{ input: '打120', expectedContains: ['120'] },
{ input: '晕倒了', expectedContains: ['紧急', '120'] }
];
for (const tc of testCases) {
try {
... | https://github.com/LJ666-ui/harmony-health-care | ddd1b26abf5f7cb722dcaef9471e36af2d4f2b9b | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | getLastIndexOf | Locates the last occurrence of a certain bit value within a range of bits in a bit vector.
@param { int } element - Element to be Located (0 means 0, else means 1).
@param { int } fromIndex - The starting position of the index, containing the value at that index position.
@param { int } toIndex - The end of the index, ... | public getLastIndexOf(element: int, fromIndex: int, toIndex: int): int {
this.checkRange(fromIndex, toIndex);
let fromElem = this.computeElementIdAndBitId(fromIndex);
let toElem = this.computeElementIdAndBitId(toIndex);
if (fromElem.elementId === toElem.element... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLastIndexOf 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 int AST#identi... | public getLastIndexOf(element: int, fromIndex: int, toIndex: int): int {
this.checkRange(fromIndex, toIndex);
let fromElem = this.computeElementIdAndBitId(fromIndex);
let toElem = this.computeElementIdAndBitId(toIndex);
if (fromElem.elementId === toElem.element... | https://gitcode.com/iop123123/arkts-static-skills | c80caa9d0a98f954a81e540b84ff5344c71be305 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets | arkts | registerResource | 注册需要释放的资源
@param resource 可释放资源 | registerResource(resource: Disposable): void {
this.checkDestroyed('registerResource');
this.resources.add(resource);
if (this.config.enableDebug) {
logger.debug(TAG, `[${this.pageId}] 资源已注册, 当前数量: ${this.resources.size}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Disposable AST#identifier#Right AST... | registerResource(resource: Disposable): void {
this.checkDestroyed('registerResource');
this.resources.add(resource);
if (this.config.enableDebug) {
logger.debug(TAG, `[${this.pageId}] 资源已注册, 当前数量: ${this.resources.size}`);
}
} | https://github.com/DaLongZhuaZi/manxia | 5a32a12f2f9e576f64c0f80a5da6072cd1967a25 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | stop | 结束播放
@returns {void} | stop(): void {
if (!this.avPlayer) {
logger.error('avPlayer no create.');
return;
}
this.avPlayer.stop();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS... | stop(): void {
if (!this.avPlayer) {
logger.error('avPlayer no create.');
return;
}
this.avPlayer.stop();
} | https://gitcode.com/arkui-x/samples | 8b920ea4d59a1a9552387b282651bcf7ecbefbda | gitcode |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Row.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
RowEndTop() { Text("Hi"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.End,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
... | https://github.com/Joker-x-dev/CoolMallArkTS | c29e5dcb46bc7f38cb8ae39aa4dea967f3e20942 | github |
openharmony/applications_app_samples | code/AI/MindSporeLiteCDemoASR/entry/src/main/ets/pages/player.ets | arkts | setAVPlayerCallback | 用于区分模式是否支持seek操作。
注册avplayer回调函数。 | setAVPlayerCallback(avPlayer: media.AVPlayer) {
// seek操作结果回调函数。
avPlayer.on('seekDone', (seekDoneTime: number) => {
console.info(`MS_LITE_LOG: AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
});
// error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程。
avPlayer.on('error', (err: Business... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAVPlayerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left avPlayer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left media ... | setAVPlayerCallback(avPlayer: media.AVPlayer) {
// seek操作结果回调函数。
avPlayer.on('seekDone', (seekDoneTime: number) => {
console.info(`MS_LITE_LOG: AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
});
// error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程。
avPlayer.on('error', (err: Business... | https://github.com/openharmony/applications_app_samples | a8db929474f1c54a21532ba587df7ccdfbe74415 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGEllipse.ets | arkts | setCY | 设置椭圆中心点y坐标
@param newCY y坐标值 | public setCY(newCY: number): void{
this._cy = newCY;
this._ellipseResultObj['cy'] = newCY;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setCY AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newCY AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public setCY(newCY: number): void{
this._cy = newCY;
this._ellipseResultObj['cy'] = newCY;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | fb90f6bb50c5f1e24c2519add3883a3d9393cbf2 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | fromAsync | Creates a new Array from array-like or iterable
@param arrLike array-like or an iterable object
@returns new instance of an Array | public static fromAsync<T>(arrLike: T[]): Array<T> {
let idLambda: (a: T, i: int) => T = (a: T, i: int): T => { return a }
return Array.fromAsync<T, T>(arrLike, idLambda)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left fromAsync AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AS... | public static fromAsync<T>(arrLike: T[]): Array<T> {
let idLambda: (a: T, i: int) => T = (a: T, i: int): T => { return a }
return Array.fromAsync<T, T>(arrLike, idLambda)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 79fe6a36b3aa9afd56077e822ba8e1827fe51bfa | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | uuid | 生成一个 uuid | public static uuid(): string {
return util.generateRandomUUID()
} | 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#identifier#Left uuid AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right A... | public static uuid(): string {
return util.generateRandomUUID()
} | https://github.com/webabcd/HarmonyDemo | 9b4b91ae8e34eaa74b389ffe5e59a1d94243b9dc | github |
erosTeam/NextE | shared/src/main/ets/parser/EhUconfigParser.ets | arkts | parseToggles | All present xn_*/xl_* checkboxes (ser + name + excluded). Name is the label/trailing text, best-effort. | private static parseToggles(html: string, prefix: string): EhUconfigToggleItem[] {
const out: EhUconfigToggleItem[] = []
const re: RegExp = new RegExp(`(<input[^>]*id="${prefix}_(\\d+)"[^>]*>)([^<]*)`, 'g')
let m: RegExpExecArray | null = re.exec(html)
while (m !== null) {
const tag: string = m[... | 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 parseToggles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : ... | private static parseToggles(html: string, prefix: string): EhUconfigToggleItem[] {
const out: EhUconfigToggleItem[] = []
const re: RegExp = new RegExp(`(<input[^>]*id="${prefix}_(\\d+)"[^>]*>)([^<]*)`, 'g')
let m: RegExpExecArray | null = re.exec(html)
while (m !== null) {
const tag: string = m[... | https://github.com/erosTeam/NextE | b456398d59a34c646cbbe3e340f2b5da6e4cffe8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array of the same type.
@param { BigInt64Array } arr - An array to convert to a new array.
@returns { BigInt64Array } - A new BigInt64Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: BigInt64Array): BigInt64Array {
let result = new BigInt64Array(arr.length)
result.set(arr)
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: BigInt64Array): BigInt64Array {
let result = new BigInt64Array(arr.length)
result.set(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 3f25e05d10a1e3ac3c5c10cb0d929b68c48215cc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | parseIndexSelector | 解析索引选择器
支持: tag.a.0, tag.a.-1, tag.a[0], tag.a[0:3], tag.a[!0] | private parseIndexSelector(rule: string): IndexSelectorResult {
const result: IndexSelectorResult = {
selector: rule,
hasIndex: false,
exclude: false,
indexes: [],
ranges: [],
items: []
};
// 检查[]式索引
if (rule.endsWith(']')) {
const bracketStart = rule.las... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseIndexSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private parseIndexSelector(rule: string): IndexSelectorResult {
const result: IndexSelectorResult = {
selector: rule,
hasIndex: false,
exclude: false,
indexes: [],
ranges: [],
items: []
};
// 检查[]式索引
if (rule.endsWith(']')) {
const bracketStart = rule.las... | https://github.com/DaLongZhuaZi/manxia | 9f79ab7f8f56a9b4316b10f60aa60311b0647ff7 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/IllustDetailViewModel.ets | arkts | illustIds | IIllustSwiperProvider 接口 | get illustIds(): number[] {
return this.relatedIllusts.map(i => i.id);
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left illustIds 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#... | get illustIds(): number[] {
return this.relatedIllusts.map(i => i.id);
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/IllustDetailViewModel.ets#L58-L60 | a8de0ff7714e90f8a61f36b9d04bc118e797c5f4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets | arkts | replacePageTemplate | 替换页码模板
支持格式:
- <,{{page}}> - 第一页为空,其他页为页码
- <page,1,2,3> - 根据页码选择对应值
- {{page}} - 直接替换为页码 | private replacePageTemplate(url: string, page: number): string {
// 处理 <page,1,2,3> 格式 - 根据页码选择值
url = url.replace(/<page,([^>]+)>/gi, (match: string, content: string): string => {
const parts = content.split(',').map(p => p.trim());
if (page <= parts.length) {
return parts[page - 1];
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replacePageTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private replacePageTemplate(url: string, page: number): string {
// 处理 <page,1,2,3> 格式 - 根据页码选择值
url = url.replace(/<page,([^>]+)>/gi, (match: string, content: string): string => {
const parts = content.split(',').map(p => p.trim());
if (page <= parts.length) {
return parts[page - 1];
... | https://github.com/DaLongZhuaZi/manxia | f66733e10a4d9d633e284349debf41bb38b6ffca | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/RustDeskLanDiscoveryService.ets | arkts | isScanning | 是否正在扫描 | isScanning(): boolean {
return this.scanning;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isScanning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statemen... | isScanning(): boolean {
return this.scanning;
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 113965d50c05cd45592df9717407956dc5505f4c | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | sendVideoCall | 发送视频呼叫 | public sendVideoCall(toMac: string, roomId: string, msg: string, callType: CallType): void {
LogUtil.info(`${TAG} sendVideoCall: from_mac=${this.mac}, to_mac=${toMac}, room_id=${roomId}, msg=${msg}, callType=${callType}`);
this.currentCallType = callType;
const env = this.buildForwardEnvelope(toMac);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendVideoCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | public sendVideoCall(toMac: string, roomId: string, msg: string, callType: CallType): void {
LogUtil.info(`${TAG} sendVideoCall: from_mac=${this.mac}, to_mac=${toMac}, room_id=${roomId}, msg=${msg}, callType=${callType}`);
this.currentCallType = callType;
const env = this.buildForwardEnvelope(toMac);
... | https://github.com/tdcare/tdwebrtc | 677604eb277899c8d6ce1a208bd42290c661859e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | getMetrics | 获取当前性能指标 | public getMetrics(): PerformanceMetrics {
return SafeUtils.parseObj(JSON.stringify(this.metrics));
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMetrics 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 Performance... | public getMetrics(): PerformanceMetrics {
return SafeUtils.parseObj(JSON.stringify(this.metrics));
} | https://github.com/DaLongZhuaZi/manxia | 60f267c5989f4e9b4f6085abac4e5461b531142e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | handleRumbleTriggers | 处理扳机震动 | handleRumbleTriggers(controllerNumber: number, leftTrigger: number, rightTrigger: number): void {
this.vibrationService.handleRumbleTriggers(controllerNumber, leftTrigger, rightTrigger);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRumbleTriggers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST... | handleRumbleTriggers(controllerNumber: number, leftTrigger: number, rightTrigger: number): void {
this.vibrationService.handleRumbleTriggers(controllerNumber, leftTrigger, rightTrigger);
} | https://github.com/AlkaidLab/moonlight-harmony | 54d48a79234a216c9f4eeb69155af0c447d58cf9 | github |
IoTAccessControl/ArkTSAnalysis | TestApps/AccountKit-QuickLogin/entry/src/main/ets/pages/QuickLoginPage.ets | arkts | jumpToPrivacyWebView | Redirect to the HUAWEI ID User Authentication Agreement page. | jumpToPrivacyWebView(privacyText: loginComponentManager.PrivacyText) {
const hasNet: boolean = connection.hasDefaultNetSync();
if (!hasNet) {
const hint: string = getContext().resourceManager.getStringSync($r('app.string.hwid_no_internet_connect'));
showToast(hint);
return;
}
if (pri... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToPrivacyWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left privacyText AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#id... | jumpToPrivacyWebView(privacyText: loginComponentManager.PrivacyText) {
const hasNet: boolean = connection.hasDefaultNetSync();
if (!hasNet) {
const hint: string = getContext().resourceManager.getStringSync($r('app.string.hwid_no_internet_connect'));
showToast(hint);
return;
}
if (pri... | https://github.com/IoTAccessControl/ArkTSAnalysis | 9f7e40abb872cb7101459f77fad50e1b7ac79d11 | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_optional/user/main.ets | arkts | func_primitive_string | 字符串类型测试函数 | function func_primitive_string() {
let instance: optionalTest.ExampleInterface = optionalTest.getInterface();
instance.funcPrimitiveString("test_string")
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left func_primitive_string AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexic... | function func_primitive_string() {
let instance: optionalTest.ExampleInterface = optionalTest.getInterface();
instance.funcPrimitiveString("test_string")
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 2bf8713dd2d0e11e64298d18609f2cb51b1f223f | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/RecentFilesService.ets | arkts | setPassword | 设置最近文件的密码
@param filePath 文件路径
@param password 密码
@returns 结果 | public static setPassword(filePath: string, password: string): Promise<boolean> {
if (!filePath || !password) {
return Promise.resolve(false);
}
return RecentFilesService.getRecentFile(filePath).then((recentFile) => {
if (!recentFile) {
return false;
}
return CryptoUtils.en... | 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 setPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public static setPassword(filePath: string, password: string): Promise<boolean> {
if (!filePath || !password) {
return Promise.resolve(false);
}
return RecentFilesService.getRecentFile(filePath).then((recentFile) => {
if (!recentFile) {
return false;
}
return CryptoUtils.en... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L475-L493 | 9821b70362080ce06cf1895b9ebeb4d52ddc2e8b | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/SecurityToolkit.ets | arkts | generateRandomBase64 | 生成随机字节并返回 Base64 | generateRandomBase64(byteLength: number): string {
try {
const rand = cryptoFramework.createRandom();
const blob = rand.generateRandomSync(byteLength);
return this.uint8ArrayToBase64(blob.data);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateRandomBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Lef... | generateRandomBase64(byteLength: number): string {
try {
const rand = cryptoFramework.createRandom();
const blob = rand.generateRandomSync(byteLength);
return this.uint8ArrayToBase64(blob.data);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
... | https://github.com/DaLongZhuaZi/NGF | 154136c7e8008bab0f74abe087827e6c0fe46966 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/TransactionDao.ets | arkts | getMonthlyExpenseRatio | 按分类统计本月支出占比(用于饼图)
@param year 年份
@param month 月份 (1-12)
@returns 各分类支出占比数据 | public async getMonthlyExpenseRatio(year: number, month: number): Promise<CategoryExpenseRatio[]> {
const startDate: number = new Date(year, month - 1, 1).getTime();
const endDate: number = new Date(year, month, 1).getTime() - 1;
const sql: string = `
SELECT
c.id as category_id,
c.n... | 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 getMonthlyExpenseRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#L... | public async getMonthlyExpenseRatio(year: number, month: number): Promise<CategoryExpenseRatio[]> {
const startDate: number = new Date(year, month - 1, 1).getTime();
const endDate: number = new Date(year, month, 1).getTime() - 1;
const sql: string = `
SELECT
c.id as category_id,
c.n... | https://github.com/fuhhhhhhhh/openharmony | d406f46f7cabc809d4ef69cdcb9ee4fb70b9a548 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/local/LocalFileStorage.ets | arkts | getInfo | 获取文件信息
@param path 文件路径
@return Promise<FileInfo> 文件信息
@throws 如果获取失败则抛出异常 | public async getInfo(path: string): Promise<FileInfo> {
return this.checkFilePermission(path, fileShare.OperationMode.READ_MODE).then((result) => {
return this.doGetInfo(path);
});
} | 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 getInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Rig... | public async getInfo(path: string): Promise<FileInfo> {
return this.checkFilePermission(path, fileShare.OperationMode.READ_MODE).then((result) => {
return this.doGetInfo(path);
});
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L151-L155 | 2dfd1be094390a7ed5d6c062d886ea0f075d9da7 | github |
openharmony/codelabs | ETSUI/SimpleApp/entry/src/main/ets/generated/viewmodel/MultiFunctionEntryModuleData.ets | arkts | getResources | Data loaded on current view converts network data into rendering data | getResources(): Promise<void> {
/**
* use your web request here
*/
return new Promise((resolve: Function) => {
const modelList: Array<DataSource> = [];
for (let index = 0; index < Data.ICONS.length;
index++) {
modelList.push(new DataSource(
Data.ICONS[index],
... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getResources 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#i... | getResources(): Promise<void> {
/**
* use your web request here
*/
return new Promise((resolve: Function) => {
const modelList: Array<DataSource> = [];
for (let index = 0; index < Data.ICONS.length;
index++) {
modelList.push(new DataSource(
Data.ICONS[index],
... | https://gitcode.com/openharmony/codelabs | 237ff88607721f2cd10410aad3d4778c36a65637 | gitcode |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | unregisterDataChangeListener | 注销一个数据变化监听器 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://gitee.com/openharmony/arkui_ace_engine.git | 4bb4ae03eaa830b9e3e21d6d77d73d24042028ee | gitee |
westinyang/F-OH | entry/src/main/ets/data/DataSource.ets | arkts | getHomePageData | 获取首页数据 | static getHomePageData(success: Function, error: Function) {
let httpRequest = http.createHttp();
httpRequest.request(api_homePageData, {
method: http.RequestMethod.GET
}, (err, data) => {
if (!err && data.responseCode == 200) {
let dataJson = JSON.parse(data.result as string) as Objec... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getHomePageData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left success AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static getHomePageData(success: Function, error: Function) {
let httpRequest = http.createHttp();
httpRequest.request(api_homePageData, {
method: http.RequestMethod.GET
}, (err, data) => {
if (!err && data.responseCode == 200) {
let dataJson = JSON.parse(data.result as string) as Objec... | https://github.com/westinyang/F-OH | 93d19bb81431dd97e877d1f365117b4eb23a1a0b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/LRU.ets | arkts | get | Retrieves the value associated with the key, moving the entry to the most recently used position.
Returns undefined if the key is not present.
@param { K } - the key to look up
@returns { V | undefined } the cached value or undefined
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public get(key: K): V | undefined {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
const node = this.map.get(key);
if (node !== undefined) {
this.moveToFront(node);
return node.value;
}
return undefined;
} final... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERRO... | public get(key: K): V | undefined {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
const node = this.map.get(key);
if (node !== undefined) {
this.moveToFront(node);
return node.value;
}
return undefined;
} final... | https://gitcode.com/iop123123/arkts-static-skills | 86d117177258fb4f2f7a9c3c294c35cd23a949dd | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | fetchAndUpdateWindowRect | 异步获取窗口矩形并更新到 C++ 层
全屏模式下窗口矩形=屏幕尺寸(已在初始化时设置),
窗口模式下获取实际窗口位置和尺寸 | private fetchAndUpdateWindowRect(): void {
try {
const context = getContext() as common.UIAbilityContext;
window.getLastWindow(context).then((win: window.Window) => {
const rect = win.getWindowProperties().windowRect;
if (rect && this.mouseInterceptorActive) {
const relativeM... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fetchAndUpdateWindowRect 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 ... | private fetchAndUpdateWindowRect(): void {
try {
const context = getContext() as common.UIAbilityContext;
window.getLastWindow(context).then((win: window.Window) => {
const rect = win.getWindowProperties().windowRect;
if (rect && this.mouseInterceptorActive) {
const relativeM... | https://github.com/AlkaidLab/moonlight-harmony | a4a6607ef796db46b36da90dbfefb635ec23693e | github |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/model/AirConditioner.ets | arkts | turnOn | 实现抽象方法:开机逻辑
开机时显示当前温度,符合空调的使用场景 | async turnOn(): Promise<void> {
try {
await delay(200); // 模拟空调启动延迟
this.temperature = 26; // 初始化空调温度
this.status = 'on';
logAction(`${this.getInfo()} 已开启,当前温度:${this.temperature}°C`);
} catch(error) {
console.error(`error: ${(error as Error).message}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left turnOn AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#... | async turnOn(): Promise<void> {
try {
await delay(200); // 模拟空调启动延迟
this.temperature = 26; // 初始化空调温度
this.status = 'on';
logAction(`${this.getInfo()} 已开启,当前温度:${this.temperature}°C`);
} catch(error) {
console.error(`error: ${(error as Error).message}`);
}
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | 91c8d70f3bf3dec3dd7ff198c78883919c960612 | gitcode |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | setWidth | Sets the 'width'.
@param width the new value of 'width' | public setWidth(width:number):void {
this.defaultWidth = width;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public setWidth(width:number):void {
this.defaultWidth = width;
} | https://gitee.com/openharmony-sig/commons-cli.git | 41ce700c1a47c3f4bacebea1425e8d3befd500ea | gitee |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | unregisterAVPlayerCallback | 取消注册内置播放器回调函数 | unregisterAVPlayerCallback(avPlayer: media.AVPlayer) {
avPlayer.off('stateChange');
avPlayer.off('timeUpdate');
avPlayer.off('durationUpdate');
avPlayer.off('videoSizeChange');
avPlayer.off('startRenderFrame');
avPlayer.off('seekDone');
avPlayer.off('error');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unregisterAVPlayerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left avPlayer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left... | unregisterAVPlayerCallback(avPlayer: media.AVPlayer) {
avPlayer.off('stateChange');
avPlayer.off('timeUpdate');
avPlayer.off('durationUpdate');
avPlayer.off('videoSizeChange');
avPlayer.off('startRenderFrame');
avPlayer.off('seekDone');
avPlayer.off('error');
} | https://github.com/fbinba3955/Flymby | ad40ca31f9cc0c2168d8c7686979f3534fefe8b6 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleViews.ets | arkts | stripReservedAndSanitize | Drops any segmentation keys that would collide with reserved view fields
("name", "visit", "start", etc.) before merging, so custom input can't
overwrite SDK-owned values. | private stripReservedAndSanitize(input: SegmentationMap): SegmentationMap {
const sanitized: SegmentationMap = Utils.sanitizeSegmentation(
input,
this.config.limits.maxKeyLength,
this.config.limits.maxValueSize,
this.config.limits.maxSegmentationValues
);
// ArkTS bans `delete`, so... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stripReservedAndSanitize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | private stripReservedAndSanitize(input: SegmentationMap): SegmentationMap {
const sanitized: SegmentationMap = Utils.sanitizeSegmentation(
input,
this.config.limits.maxKeyLength,
this.config.limits.maxValueSize,
this.config.limits.maxSegmentationValues
);
// ArkTS bans `delete`, so... | https://github.com/Countly/countly-sdk-hos | f38e8d7ddbcf4f8b1dd359ff1a0de88e865199f5 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | setPngOptimizeDecoding | 设置默认解码是否使用优化png图片解码
没有调用时,默认不启用
设置为true后,图片会优化Png解码,以减小解码后的图片内存占用
如果Png图片设置了图形变换,则不会应用该解码优化,仍然使用默认的解码方式
启用后,GetCacheImage接口可能获取到非RGBA像素的格式的pixelmap
@param enable 是否开启png解码优化 | setPngOptimizeDecoding(enable: boolean) {
nativeNode.setPngOptimizeDecoding(enable);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPngOptimizeDecoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#iden... | setPngOptimizeDecoding(enable: boolean) {
nativeNode.setPngOptimizeDecoding(enable);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L366-L368 | fdbb3d52cf942691d27b558b2503d93f6740dcd0 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/registry/matcher.ets | arkts | matchProviderSpec | ============ Provider 匹配 ============ | function matchProviderSpec(info: CompatibilityProviderInfo, spec: ProviderMatchSpec): boolean {
const normalizedBaseUrl = normalizeCompatibilityBaseUrl(info.baseUrl)
if (spec.providerIds !== undefined) {
for (let i = 0; i < spec.providerIds.length; i++) {
if (info.providerId === spec.providerIds[i]) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left matchProviderSpec AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left info AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function matchProviderSpec(info: CompatibilityProviderInfo, spec: ProviderMatchSpec): boolean {
const normalizedBaseUrl = normalizeCompatibilityBaseUrl(info.baseUrl)
if (spec.providerIds !== undefined) {
for (let i = 0; i < spec.providerIds.length; i++) {
if (info.providerId === spec.providerIds[i]) {
... | https://github.com/LongLiveY96/chatcube | 74458565df585db61aa0fa9c64f59135bd6a6424 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | hasLazyRelation | 检查是否存在延迟加载关联
@param propertyName 关联属性名 | hasLazyRelation(propertyName: string): boolean {
return this.lazyRelationLoaders.has(propertyName)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasLazyRelation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )... | hasLazyRelation(propertyName: string): boolean {
return this.lazyRelationLoaders.has(propertyName)
} | https://github.com/offlinecat-dev/OCNetORM | 13d2b1620a5ab3a653bdb64c84201e3207ce541c | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | getSpecialIndex | 如果在特殊字符串里粘贴数字,将光标位置重新计算
@param 光标位置
@param 展示的字符串
@returns 重新计算后的光标位置 | public static getSpecialIndex(index: number, value: string): number {
let startIndex: number = index;
for (let i = startIndex; i < value.length; i++) {
if (['a', 'c', 'o', 'n', 'l', 's', 'g', 't', 'i', '\u207B', '\u00B9', '('].includes(value[i])) {
index = i + 1;
if (value[i] === '(') {
... | 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 getSpecialIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left :... | public static getSpecialIndex(index: number, value: string): number {
let startIndex: number = index;
for (let i = startIndex; i < value.length; i++) {
if (['a', 'c', 'o', 'n', 'l', 's', 'g', 't', 'i', '\u207B', '\u00B9', '('].includes(value[i])) {
index = i + 1;
if (value[i] === '(') {
... | https://gitee.com/openharmony-sig/applications_calculator.git | 3c3377c3edb3edd9a7d5e55feab064f1e00e4e03 | gitee |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootLoginInjection | 测试通道:want.parameters.bootLogin=true,
仅强制 WelcomePage 进入 LoginPage,不清除现有 token,方便保留登录态做 UI 回归。 | private handleBootLoginInjection(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_LOGIN];
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 handleBootLoginInjection 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#iden... | private handleBootLoginInjection(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_LOGIN];
if (typeof raw !== 'string') {
return;
}... | https://github.com/CarGuo/GSYGithubAppOH | 5f3640a285f211d0762a5637ba33086bfa383319 | github |
openharmony/applications_calendar_data | dataprovider/src/main/ets/DataShareAbilityAuthenticateProxy.ets | arkts | addPermissionUsedRecordInCallBack | Perform database operations corresponding to permissions
@param err Error object
@Param tokenId
@Param permission indicates permission to be verified | function addPermissionUsedRecordInCallBack(err: BusinessError, tokenId: string, permission: Permissions) {
// add Permission Used Record
if (hasNoError(err)) {
try {
privacyManager.addPermissionUsedRecord(Number(tokenId), permission, SUCCESS_COUNT, 0)
.then(() => {
console.log('addPermis... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left addPermissionUsedRecordInCallBack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left err AST#identifier#Right AST#type_annotation#Left AS... | function addPermissionUsedRecordInCallBack(err: BusinessError, tokenId: string, permission: Permissions) {
// add Permission Used Record
if (hasNoError(err)) {
try {
privacyManager.addPermissionUsedRecord(Number(tokenId), permission, SUCCESS_COUNT, 0)
.then(() => {
console.log('addPermis... | https://gitee.com/openharmony/applications_calendar_data.git | 335964e80110d3f2e40b7975631b26c472bb1590 | gitee |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | releaseAVPlayer | 释放AVPlayer资源 | releaseAVPlayer(): void {
if (!this.avPlayer) {
return;
}
this.avPlayer.release();
this.avPlayer = undefined;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left releaseAVPlayer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl... | releaseAVPlayer(): void {
if (!this.avPlayer) {
return;
}
this.avPlayer.release();
this.avPlayer = undefined;
} | https://gitcode.com/arkui-x/samples | 827b23a2372b762cddce2adbca8c6487e78cc8e6 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | getActiveProfile | 获取当前活跃配置 | static async getActiveProfile(): Promise<CustomKeyProfile> {
await CustomKeyStore.ensureInit();
const profile = CustomKeyStore.profiles!.find(p => p.name === CustomKeyStore.activeProfileName);
return profile ?? CustomKeyStore.profiles![0];
} | 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 getActiveProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | static async getActiveProfile(): Promise<CustomKeyProfile> {
await CustomKeyStore.ensureInit();
const profile = CustomKeyStore.profiles!.find(p => p.name === CustomKeyStore.activeProfileName);
return profile ?? CustomKeyStore.profiles![0];
} | https://github.com/AlkaidLab/moonlight-harmony | ed39e3d3691f45cd9b866e8ac135e30d509556be | github |
Yebingiscn/SweetVideo | entry/src/main/ets/controller/MpvController/MpvController.ets | arkts | cleanupMpvInstance | 清理MPV实例 | private cleanupMpvInstance() {
if (this.mpvHandle) {
try {
mpvUnregisterPlaybackCompleteCallback()
mpvUnregisterTimeUpdateCallback()
mpvUnregisterVideoSizeChangedCallback()
mpvUnregisterSurfaceModeErrorCallback()
mpvUnregisterBufferingStateCallback()
mpvDestro... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left cleanupMpvInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#... | private cleanupMpvInstance() {
if (this.mpvHandle) {
try {
mpvUnregisterPlaybackCompleteCallback()
mpvUnregisterTimeUpdateCallback()
mpvUnregisterVideoSizeChangedCallback()
mpvUnregisterSurfaceModeErrorCallback()
mpvUnregisterBufferingStateCallback()
mpvDestro... | https://github.com/Yebingiscn/SweetVideo | bae9eede060c84f8ea07d372914e7c2e29d7030a | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | getUTCDate | Returns the day of the month (from 1 to 31) in the specified date according to universal time.
@returns An integer number, between 1 and 31, representing the day of the month for the given date according to local time. | public getUTCDate(): byte {
let localTime = this.ms;
let day: int = ecmaDayFromTime(localTime) - ecmaDayFromYear(ecmaYearFromTime(localTime));
let inLeapYear = ecmaInLeapYear(this.getFullYear());
let firstDay: int = getFirstDayInMonth(inLeapYear, ecmaMonthFromTime(localTime));
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCDate 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 byte AST#id... | public getUTCDate(): byte {
let localTime = this.ms;
let day: int = ecmaDayFromTime(localTime) - ecmaDayFromYear(ecmaYearFromTime(localTime));
let inLeapYear = ecmaInLeapYear(this.getFullYear());
let firstDay: int = getFirstDayInMonth(inLeapYear, ecmaMonthFromTime(localTime));
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b533089a1ae520d5ed17eed7046c82c20fef9a11 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/OperationView.ets | arkts | receMsg | rece msg
@param calcuCallBack Function | receMsg(value: string): void {
this.worker.onmessage = (msg: MessageEvents) => {
this.result = msg.data.result;
if (DisplayUtil.isNumber(msg.data.exp) || DisplayUtil.isNumber(value.replace(new RegExp(',', 'g'), '')) ||
this.isOperatorChar(value)) {
this.result = '';
}
if (thi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left receMsg 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 string AST#identifier#Right AST#)#Left ) AST#)#... | receMsg(value: string): void {
this.worker.onmessage = (msg: MessageEvents) => {
this.result = msg.data.result;
if (DisplayUtil.isNumber(msg.data.exp) || DisplayUtil.isNumber(value.replace(new RegExp(',', 'g'), '')) ||
this.isOperatorChar(value)) {
this.result = '';
}
if (thi... | https://gitee.com/openharmony-sig/applications_calculator.git | 5345ac235fd0ea9f03a5cac98161bb5d25aac6ab | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | valueOf | Returns the object itself
@returns { Uint16Array }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public valueOf(): Uint16Array {
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Uint16Array AS... | public valueOf(): Uint16Array {
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 7a90b92a8070fb59ac208380be6d351b3a2836af | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets | arkts | setScreenWidth | 设置屏幕宽度(用于计算降采样比例) | public setScreenWidth(width: number): void {
if (width > 0) {
this.screenWidth = width;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setScreenWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public setScreenWidth(width: number): void {
if (width > 0) {
this.screenWidth = width;
}
} | https://github.com/DaLongZhuaZi/manxia | 68cd1797c54ca991282b11d8518f510823cfe3d6 | github |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/component/FocusableDivider.ets | arkts | build | 构建分割线
@returns {void} 无返回值 | build(): void {
ColumnStart({ widthValue: P100 }) {
if (this.withSpacing) {
SpaceVerticalLarge();
}
Column()
.width(P100)
.height(this.thickness)
.backgroundColor(this.focused ? this.activeColor : this.inactiveColor);
}
} | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnStart({ widthValue: P100 }) {
if (this.withSpacing) {
SpaceVerticalLarge();
}
Column()
.width(P100)
.height(this.thickness)
.backgroundColor(this.focused ? this.activeColor : this.inactiveColor);
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | d86c09c715a0017bafacf91149a2fc4d33290138 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | sum | 计算指定列的总和
@param column 列名或属性名
@returns Promise<number> | async sum(column: string): Promise<number> {
return await this.withStoreLease(async () => {
return await this.aggregateExecutor.sum(column)
})
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sum AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left column AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | async sum(column: string): Promise<number> {
return await this.withStoreLease(async () => {
return await this.aggregateExecutor.sum(column)
})
} | https://github.com/offlinecat-dev/OCNetORM | 5bead2956b4915cf4ce21414c6ae3efbc8c79ff4 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | generateTempFileName | 生成临时文件名
@param originalPath 原文件路径
@returns 生成的临时文件名 | private static generateTempFileName(originalPath: string): string {
const extension = LubanUtils.getFileExtension(originalPath) || 'tmp';
const nameWithoutExt = LubanUtils.getFileNameWithoutExtension(originalPath);
const timestamp = Date.now();
const random = Math.floor(Math.random() * 1000);
ret... | 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 generateTempFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalPath AST#identifier#Right AST#ERROR#Le... | private static generateTempFileName(originalPath: string): string {
const extension = LubanUtils.getFileExtension(originalPath) || 'tmp';
const nameWithoutExt = LubanUtils.getFileNameWithoutExtension(originalPath);
const timestamp = Date.now();
const random = Math.floor(Math.random() * 1000);
ret... | https://github.com/kumaleap/ArkLuban | 9c2f3e9362e086125f0d9d91bfcf5e7400cc3fc7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets | arkts | constructor | Construct a ConcurrentHashMap without parameters. | constructor() {
this.buckets = new ConcurrentHashMapBucket < K, V > [ConcurrentHashMap.MIN_BUCKETS_COUNT](undefined);
this.bucketMutex = new (Object | undefined)[ConcurrentHashMap.MIN_BUCKETS_COUNT](undefined);
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.buckets = new ConcurrentHashMapBucket < K, V > [ConcurrentHashMap.MIN_BUCKETS_COUNT](undefined);
this.bucketMutex = new (Object | undefined)[ConcurrentHashMap.MIN_BUCKETS_COUNT](undefined);
} | https://gitcode.com/iop123123/arkts-static-skills | a716de079563a9ccb2b9182f52c5a2013d5e47e4 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/radio/index.ets | arkts | handleCheckedChange | 改变选中状态的回调 | handleCheckedChange() {
if (this.getIsDisabled() || this.isChecked) {
return
}
this.updateGroup()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleCheckedChange 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_bloc... | handleCheckedChange() {
if (this.getIsDisabled() || this.isChecked) {
return
}
this.updateGroup()
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/radio/index.ets#L162-L167 | 8dfa28e3210a6ed3b49d2959be85280da477fabe | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ReportGenerator.ets | arkts | generateReportId | 生成报告ID
@returns 唯一报告ID | private generateReportId(): string {
return `RPT_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateReportId 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... | private generateReportId(): string {
return `RPT_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | https://github.com/LJ666-ui/harmony-health-care | f210ed90df428a616fe37ed24682dabce9870696 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/TokenManager.ets | arkts | getDoctorInfo | 获取医生信息 | static getDoctorInfo(): any | null {
const doctorInfoStr = SettingsUtil.get('doctorInfo');
if (doctorInfoStr) {
try {
return JSON.parse(doctorInfoStr);
} catch (e) {
return null;
}
}
return null;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDoctorInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left A... | static getDoctorInfo(): any | null {
const doctorInfoStr = SettingsUtil.get('doctorInfo');
if (doctorInfoStr) {
try {
return JSON.parse(doctorInfoStr);
} catch (e) {
return null;
}
}
return null;
} | https://github.com/LJ666-ui/harmony-health-care | 03475c06065a0211cb3b9b66c70a269c5761d451 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getDividerColor | 获取分割线颜色 | public getDividerColor(): string {
return AppColors.divider;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDividerColor 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... | public getDividerColor(): string {
return AppColors.divider;
} | https://github.com/DaLongZhuaZi/manxia | ea614d01c6ead59383dc8dba9b8e8e53d00c78f8 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | add | Add a set of data to PlainArray.
@param key the key of the element to add | public add(key: int, value: T): void {
this.checkKey(key);
this.buckets.set(key, value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public add(key: int, value: T): void {
this.checkKey(key);
this.buckets.set(key, value);
} | https://gitcode.com/iop123123/arkts-static-skills | 824d75a040ed32e4c9ba0fe67d80225fc74d19af | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/MetadataXmlGenerator.ets | arkts | parseNovelMetadataXml | 解析小说元数据XML | static parseNovelMetadataXml(xmlContent: string): NovelMetadata | null {
try {
const getTagValue = (tagName: string): string => {
const regex = new RegExp(`<${tagName}>([\\s\\S]*?)</${tagName}>`, 'i');
const match = xmlContent.match(regex);
return match ? MetadataXmlGenerator.unescap... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseNovelMetadataXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xmlContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | static parseNovelMetadataXml(xmlContent: string): NovelMetadata | null {
try {
const getTagValue = (tagName: string): string => {
const regex = new RegExp(`<${tagName}>([\\s\\S]*?)</${tagName}>`, 'i');
const match = xmlContent.match(regex);
return match ? MetadataXmlGenerator.unescap... | https://github.com/DaLongZhuaZi/manxia | f2eb5947e8d7833c98ad8a7dfaa72d31ce9eb9bf | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/location/PermissionManager.ets | arkts | openSystemSettings | 打开系统设置页面
uri:根据‘设置’应用配置的界面信息,选择不同的uri | openSystemSettings(context: common.UIAbilityContext, uri?: string) {
let wantInfo: Want = {}
wantInfo = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility',
uri: uri,
parameters: { pushParams: context.abilityInfo.bundleName }
}
context... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openSystemSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifi... | openSystemSettings(context: common.UIAbilityContext, uri?: string) {
let wantInfo: Want = {}
wantInfo = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility',
uri: uri,
parameters: { pushParams: context.abilityInfo.bundleName }
}
context... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | d15890050cd7b182a20b929b794b67f88a5fe1a1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HtmlParserLogger.ets | arkts | setDebugEnabled | 启用/禁用调试日志 | static setDebugEnabled(enabled: boolean): void {
HtmlParserLogger._debugEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDebugEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static setDebugEnabled(enabled: boolean): void {
HtmlParserLogger._debugEnabled = enabled;
} | https://github.com/DaLongZhuaZi/manxia | 39e61cc18546909482e52d6c377e0e52368f3b52 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets | arkts | checkDayTasksCompleted | 检查当天的任务是否完成 | private checkDayTasksCompleted(tasks: DailyTask[], records: SportData[]): boolean {
if (tasks.length === 0) {
return false; // 没有任务,不算完成
}
// 计算当天的统计数据
const dayStats: DayStatistics = {
distance: records.reduce((sum, r) => sum + r.distance, 0),
duration: records.reduce((sum, r) => s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkDayTasksCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tasks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subsc... | private checkDayTasksCompleted(tasks: DailyTask[], records: SportData[]): boolean {
if (tasks.length === 0) {
return false; // 没有任务,不算完成
}
// 计算当天的统计数据
const dayStats: DayStatistics = {
distance: records.reduce((sum, r) => sum + r.distance, 0),
duration: records.reduce((sum, r) => s... | https://gitcode.com/openharmony/codelabs | 0059fba227a8871105c8d08e0aa6b68b7c42f709 | gitcode |
openharmony-sig/FastBle | library/src/main/ets/bluetooth/BleConnector.ets | arkts | setMtu | set mtu | public setMtu(requiredMtu: number, bleMtuChangedCallback: BleMtuChangedCallback): void {
this.bleMtuChangedCallback = bleMtuChangedCallback;
this.handleSetMtuCallback(bleMtuChangedCallback);
try {
if (!!this.mBluetoothGatt) {
this.mBluetoothGatt.setBLEMtuSize(requiredMtu)
bleMtuChang... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMtu AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requiredMtu AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Righ... | public setMtu(requiredMtu: number, bleMtuChangedCallback: BleMtuChangedCallback): void {
this.bleMtuChangedCallback = bleMtuChangedCallback;
this.handleSetMtuCallback(bleMtuChangedCallback);
try {
if (!!this.mBluetoothGatt) {
this.mBluetoothGatt.setBLEMtuSize(requiredMtu)
bleMtuChang... | https://gitee.com/openharmony-sig/FastBle.git | 0216af455a9dcab5a028787b54822394fe24c879 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartBudgetService.ets | arkts | detectSeasonalFactors | 检测季节性因子(使用高级统计分析) | private static detectSeasonalFactors(historicalData: CategoryHistoricalData[]): SeasonalFactor[] {
hilog.info(HILOG_DOMAIN, LOG_TAG, '开始季节性检测(高级统计分析)');
try {
// 准备批量检测数据
const dataList: CategoryMonthlyData[]= historicalData
.filter((data: CategoryHistoricalData) => data.monthlyAmounts.le... | 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 detectSeasonalFactors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left historicalData AST#identifier#... | private static detectSeasonalFactors(historicalData: CategoryHistoricalData[]): SeasonalFactor[] {
hilog.info(HILOG_DOMAIN, LOG_TAG, '开始季节性检测(高级统计分析)');
try {
// 准备批量检测数据
const dataList: CategoryMonthlyData[]= historicalData
.filter((data: CategoryHistoricalData) => data.monthlyAmounts.le... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | eab35f9bb0743473f2ef4b63d17552de653511b5 | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/services/JumpService.ets | arkts | init | 初始化上下文
必须在 EntryAbility 的 onCreate 或 onWindowStageCreate 中调用 | public init(context: common.UIAbilityContext) {
this.context = context;
this.logger.info('JumpService initialized with context.');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AS... | public init(context: common.UIAbilityContext) {
this.context = context;
this.logger.info('JumpService initialized with context.');
} | https://gitcode.com/openharmony/codelabs | 6cf02a9c044708b50c77a8a44cd789a584ad9b69 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | needsLogin | 检查书源是否需要登录 | needsLogin(source: LegadoBookSource): boolean {
return !!source.loginUrl;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left needsLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LegadoBookSource AST#identifier#Right AST#)... | needsLogin(source: LegadoBookSource): boolean {
return !!source.loginUrl;
} | https://github.com/DaLongZhuaZi/manxia | 499d15de63c1e35d36a157e31d845aa09df193df | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/SunAngleHelper.ets | arkts | solarPosition | 简化的太阳位置计算(用于高级评估器)
@param latitude 纬度
@param longitude 经度
@param dayOfYear 一年中的第几天(1-365)
@param minuteOfDay 一天中的第几分钟(0-1439)
@param timeZone 时区 | static solarPosition(latitude: number, longitude: number, dayOfYear: number,
minuteOfDay: number, timeZone: number): SunPosition {
const declination = SunAngleHelper.solarDeclination(dayOfYear);
const eqTime = SunAngleHelper.equationOfTime(dayOfYear);
// 计算真实太阳时
const trueS... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left solarPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left latitude AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | static solarPosition(latitude: number, longitude: number, dayOfYear: number,
minuteOfDay: number, timeZone: number): SunPosition {
const declination = SunAngleHelper.solarDeclination(dayOfYear);
const eqTime = SunAngleHelper.equationOfTime(dayOfYear);
// 计算真实太阳时
const trueS... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | d48a707576e7362dc4cb8a93cb460980178b88d2 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/AnnotationEngine.ets | arkts | generateAnnotations | 生成标注
@param ocrResult OCR识别结果
@param params 标注参数
@returns 标注列表 | async generateAnnotations(ocrResult: OCRResult, params?: AnnotationParams): Promise<ImageAnnotation[]> {
console.info('[AnnotationEngine] 开始生成标注');
const annotations: ImageAnnotation[] = [];
// 生成文字框标注
if (params?.generateTextBoxes !== false) {
for (let i = 0; i < ocrResult.textBlocks.length; ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left generateAnnotations AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ocrResult AST#identifier#Right AST#type_annotation... | async generateAnnotations(ocrResult: OCRResult, params?: AnnotationParams): Promise<ImageAnnotation[]> {
console.info('[AnnotationEngine] 开始生成标注');
const annotations: ImageAnnotation[] = [];
// 生成文字框标注
if (params?.generateTextBoxes !== false) {
for (let i = 0; i < ocrResult.textBlocks.length; ... | https://github.com/LJ666-ui/harmony-health-care | fc339b58b6b59be54e4cf0352373c6110ddf4b0a | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkItem.ets | arkts | from | Creates a shallow copy of the given item.
@param item The item to be cloned.
@returns A shallow copy of the given item. | static from(item: meowBookmarkItem) {
const clone = new meowBookmarkItem(item.isFolder, item.title, item.url, item.date_added, item.date_modified);
clone.children = item.children;
return clone;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:... | static from(item: meowBookmarkItem) {
const clone = new meowBookmarkItem(item.isFolder, item.title, item.url, item.date_added, item.date_modified);
clone.children = item.children;
return clone;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | aab9239bb41e45648f90a75b868029296ade49a7 | github |
ibestservices/ibest-ui | library/src/main/ets/components/dateTimePicker/index.ets | arkts | handleGroupChange | 处理同组日期变化 | handleGroupChange(uniId: number, selectedValues: string[]) {
if(this.uniId > uniId){
let selectDate = dateUtils(selectedValues.slice(0, 3).join('-') + ' ' + selectedValues.slice(3).join(":")).toDate()
this.minDate = selectDate
if(selectDate > this.maxDate || selectDate < this.minDate){
this.value = sele... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleGroupChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uniId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#... | handleGroupChange(uniId: number, selectedValues: string[]) {
if(this.uniId > uniId){
let selectDate = dateUtils(selectedValues.slice(0, 3).join('-') + ' ' + selectedValues.slice(3).join(":")).toDate()
this.minDate = selectDate
if(selectDate > this.maxDate || selectDate < this.minDate){
this.value = sele... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dateTimePicker/index.ets#L319-L328 | 1dcc4b636d1200a08394ecbb7a06e2a4b48e98fc | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/badge/TnBadge.ets | arkts | getBadgeSizeConfig | 根据尺寸类型获取徽标尺寸配置
@param size 尺寸类型
@returns 尺寸配置 | function getBadgeSizeConfig(size: TnBadgeSizeType | undefined): TnBadgeSizeConfig {
switch (size) {
case "sm":
return {
fontSizeKey: "fontSizeXs",
paddingHorizontal: 3,
dotSize: 6,
iconSize: 8,
minWidth: 14,
height: 14
};
case "lg":
return {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getBadgeSizeConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left size AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function getBadgeSizeConfig(size: TnBadgeSizeType | undefined): TnBadgeSizeConfig {
switch (size) {
case "sm":
return {
fontSizeKey: "fontSizeXs",
paddingHorizontal: 3,
dotSize: 6,
iconSize: 8,
minWidth: 14,
height: 14
};
case "lg":
return {
... | https://github.com/codelably/tuniao-ui | cb130352bee70efcc4f7fcace219e7dcff7ac651 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets | arkts | setOnCloseListener | TCP 关闭事件订阅
@param callback | setOnCloseListener(callback: () => void): void {
Logger.info(`${TAG} TCP setOnCloseListener into`);
this.tcpSocket?.on('close', () => {
Logger.info(`${TAG} TCP setOnCloseListener onClose:`);
callback();
this.closeSocket();
});
this.tcpSocket?.on('error', (data) => {
Logger.inf... | AST#program#Left AST#ERROR#Left AST#identifier#Left setOnCloseListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right A... | setOnCloseListener(callback: () => void): void {
Logger.info(`${TAG} TCP setOnCloseListener into`);
this.tcpSocket?.on('close', () => {
Logger.info(`${TAG} TCP setOnCloseListener onClose:`);
callback();
this.closeSocket();
});
this.tcpSocket?.on('error', (data) => {
Logger.inf... | https://github.com/openharmony/applications_app_samples | ff04c4dda741900a24aaa08c8497e409914a500c | github |
LongLiveY96/chatcube | entry/src/main/ets/utils/LunarCalendarUtils.ets | arkts | getYearDays | 获取某年农历的总天数 | function getYearDays(year: number): number {
let sum = 348
const index = year - 1900
if (index < 0 || index >= LUNAR_INFO.length) {
return sum
}
for (let i = 0x8000; i > 0x8; i >>= 1) {
if ((LUNAR_INFO[index] & i) !== 0) {
sum += 1
}
}
return sum + getLeapMonthDays(year)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getYearDays AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function getYearDays(year: number): number {
let sum = 348
const index = year - 1900
if (index < 0 || index >= LUNAR_INFO.length) {
return sum
}
for (let i = 0x8000; i > 0x8; i >>= 1) {
if ((LUNAR_INFO[index] & i) !== 0) {
sum += 1
}
}
return sum + getLeapMonthDays(year)
} | https://github.com/LongLiveY96/chatcube | 3af5409e6012e4c9d4edbe78d707d9d48e3d4dd0 | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | addContact | Add Contact
@param {Object} addParams Contact Information
@param {Object} callBack | async addContact(addParams: ContactInfo, callBack?: Function, context?: common.UIAbilityContext) {
HiLog.i(TAG, 'Start to create a new contact.');
if (addParams == undefined || addParams == null) {
HiLog.e(TAG, 'The addParams of parameter is NULL');
return;
}
let DAHelper: dataShare.DataSh... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left addContact AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left addParams AST#identifier#Right AST#type_annotation#Left AST... | async addContact(addParams: ContactInfo, callBack?: Function, context?: common.UIAbilityContext) {
HiLog.i(TAG, 'Start to create a new contact.');
if (addParams == undefined || addParams == null) {
HiLog.e(TAG, 'The addParams of parameter is NULL');
return;
}
let DAHelper: dataShare.DataSh... | https://gitee.com/openharmony/applications_contacts.git | 5946917ebb70675a75390bfae644cb96a353b64f | gitee |
dingzhilin1990/zhilinclaw | src/security/CredentialVault.ets | arkts | get | 获取凭证值(解密后)
@param id 凭证 ID
@param executor 请求者(插件/技能名称)
@param context 验证上下文 | public async get(
id: string,
executor: string,
context?: any
): Promise<string | null> {
const credential = this.credentials.get(id);
if (!credential) {
await this.logAccess(id, executor, false, '凭证不存在');
return null;
}
// 检查是否过期
if (credential.expiresAt && Date.now() ... | 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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST... | public async get(
id: string,
executor: string,
context?: any
): Promise<string | null> {
const credential = this.credentials.get(id);
if (!credential) {
await this.logAccess(id, executor, false, '凭证不存在');
return null;
}
// 检查是否过期
if (credential.expiresAt && Date.now() ... | https://github.com/dingzhilin1990/zhilinclaw | 1ee25301ccea68373bdf222cf2455959701ebb9c | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/FaceRecPage.ets | arkts | switchToOtherAuth | 切换到其他认证方式 | switchToOtherAuth() {
router.pushUrl({
url: 'pages/PasswordEntry'
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switchToOtherAuth 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#... | switchToOtherAuth() {
router.pushUrl({
url: 'pages/PasswordEntry'
});
} | https://gitcode.com/openharmony/codelabs | 90182f833e9a1b761ef5da38920abf92aa80db13 | gitcode |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/search/index.ets | arkts | build | 渲染搜索输入框与结果列表。 | build() {
Stack({ alignContent: Alignment.Top }) {
Column({ space: 12 }) {
Search({ value: this.keyword, placeholder: this.resolvePlaceholder() })
.searchIcon(
new SymbolGlyphModifier($r('sys.symbol.magnifyingglass'))
.fontColor([this.app.theme.palette.textSeconda... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack({ alignContent: Alignment.Top }) {
Column({ space: 12 }) {
Search({ value: this.keyword, placeholder: this.resolvePlaceholder() })
.searchIcon(
new SymbolGlyphModifier($r('sys.symbol.magnifyingglass'))
.fontColor([this.app.theme.palette.textSeconda... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/search/index.ets#L383-L454 | 634cee274bef6ef7a649e506d1278d301b55b955 | github |
LongLiveY96/chatcube | entry/src/main/ets/models/ChatModels.ets | arkts | hasToolCalls | 检查是否有工具调用 | hasToolCalls(): boolean {
return this.toolCalls.length > 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasToolCalls AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem... | hasToolCalls(): boolean {
return this.toolCalls.length > 0
} | https://github.com/LongLiveY96/chatcube | 910e4ff507cdb5ca79d5f07b7662cf84a44aac55 | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | getSongItemAtQueueIndex | Resolves SongItem at queue index via MusicAppState. | private getSongItemAtQueueIndex(index: number): SongItem | undefined {
return this.getAppState().resolveSongAtQueueIndex(index);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSongItemAtQueueIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private getSongItemAtQueueIndex(index: number): SongItem | undefined {
return this.getAppState().resolveSongAtQueueIndex(index);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 58ea44c1d449a83275a0c419fa1de96f4935414a | gitcode |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Row.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
RowSpaceBetweenTop() { Text("A"); Text("B"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceBetween,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | https://github.com/Joker-x-dev/CoolMallArkTS | 6f75698e2e9ef6c46458b1c101d87ad1f347e3c2 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/entryability/EntryAbility.ets | arkts | getCloudWishlist | V0.6.6: exposed for pages that need to display pending redemptions
or apply incoming decisions. Returns undefined until installCloudWishlist
resolves; pages should null-check before subscribing. | getCloudWishlist(): CloudWishlistService | undefined {
return this.cloudWishlistSvc;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCloudWishlist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifier#Left CloudWishlistServi... | getCloudWishlist(): CloudWishlistService | undefined {
return this.cloudWishlistSvc;
} | https://github.com/terryma2024/happyword | f2b8066b50cc7bc2aea27d4213ae2f0ab6465f93 | github |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | SetCodeCallBack | 设置有序公共事件的结果代码回调 | function SetCodeCallBack() {
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left SetCodeCallBack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}#Left } AS... | function SetCodeCallBack() {
} | https://gitee.com/openharmony/codelabs.git | 6be5db3b6d8e7fad0ea581daa124355985392a68 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | startsWith | Checks that the substring of this string that starts from
the specified index starts with the specified prefix.
Negative `fromIndex` is treated as 0. Result is always true
if `prefix` is empty.
@param prefix prefix string
@param fromIndex index to start from
@throws NullPointerException if prefix param is null
@returns... | public startsWith(prefix: String, fromIndex: number): boolean {
return this.startsWith(prefix, fromIndex as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startsWith 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#identifier#Left Str... | public startsWith(prefix: String, fromIndex: number): boolean {
return this.startsWith(prefix, fromIndex as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 903d6d403fc94ca5ee990794f18dd0608b573826 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets | arkts | convertToChapter | 将旧的ChapterInfo转换为新的Chapter类型 | static convertToChapter(legacy: LegacyChapterInfo): Chapter {
// 判断是本地章节还是在线章节
const isLocal = !legacy.externalId;
if (isLocal) {
// 本地章节
return {
id: legacy.id,
mangaId: legacy.comicId,
title: legacy.title,
chapterNumber: legacy.chapterNumber || legacy.ind... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left legacy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static convertToChapter(legacy: LegacyChapterInfo): Chapter {
// 判断是本地章节还是在线章节
const isLocal = !legacy.externalId;
if (isLocal) {
// 本地章节
return {
id: legacy.id,
mangaId: legacy.comicId,
title: legacy.title,
chapterNumber: legacy.chapterNumber || legacy.ind... | https://github.com/DaLongZhuaZi/manxia | e27a5be4ab855a20bfbdcf6a62c5600ed11f32f5 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | tanh | Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this Decimal.
@returns { Decimal } the Decimal type | public tanh(): Decimal {
let x: Decimal = this;
if (!x.isFinite()) {
return new Decimal(x.s);
}
if (x.isZero()) {
return new Decimal(x);
}
let pr = Decimal.precision;
let rm = Decimal.rounding;
Decimal.precision = pr + 7;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left tanh 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#:#Righ... | public tanh(): Decimal {
let x: Decimal = this;
if (!x.isFinite()) {
return new Decimal(x.s);
}
if (x.isZero()) {
return new Decimal(x);
}
let pr = Decimal.precision;
let rm = Decimal.rounding;
Decimal.precision = pr + 7;
... | https://gitcode.com/iop123123/arkts-static-skills | 753cfd594357335f76510eb1facd181db862c5b9 | gitcode |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/swiper/TnSwiper.ets | arkts | build | ==================== 构建方法 ==================== | build() {
Stack({ alignContent: resolveIndicatorAlignment(this.indicatorPosition) }) {
// 轮播内容
Swiper(this.swiperController) {
ForEach(this.data, (url: string, index: number) => {
this.SwiperItemContent(url, index);
}, (url: string, index: number) => `${this.effect}_${index}_... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Stack({ alignContent: resolveIndicatorAlignment(this.indicatorPosition) }) {
// 轮播内容
Swiper(this.swiperController) {
ForEach(this.data, (url: string, index: number) => {
this.SwiperItemContent(url, index);
}, (url: string, index: number) => `${this.effect}_${index}_... | https://github.com/codelably/tuniao-ui | a4d334bcc26aab2ade0ecc88afca37d6695f9790 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/pages/login.ets | arkts | getAbilityContext | 获取UIAbilityContext | getAbilityContext(): common.UIAbilityContext {
return getContext(this) as common.UIAbilityContext;
} | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAbilityContext 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#ide... | getAbilityContext(): common.UIAbilityContext {
return getContext(this) as common.UIAbilityContext;
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 5ae6f9cbfaa95e75492c860083d1ba750710d651 | github |
Your-USTC/DailyNic_HMOS | entry/src/main/ets/utils/Classes/ScheduleManager.ets | arkts | switchTempSemester | 临时切换课表,用于在功能页查看
@param target 目标学期索引
@returns undefined,但如果发生错误则返回错误信息的字符串 | switchTempSemester(target: number): string | undefined {
try {
this.displaySemester = target;
this.rebuildDisplayIndex(JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[target].createTime), '[]')) as classAttribute[]);
return;
} catch(err) {
return JSON.strin... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left switchTempSemester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | switchTempSemester(target: number): string | undefined {
try {
this.displaySemester = target;
this.rebuildDisplayIndex(JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[target].createTime), '[]')) as classAttribute[]);
return;
} catch(err) {
return JSON.strin... | https://github.com/Your-USTC/DailyNic_HMOS | 5dc40e5f3d995d34a50466a48da56c3ebc369ff3 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets | arkts | get_eq | 获取当前 GEQ 增益值 | get_eq(): number[] {
return nativeModule.get_eq()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left get_eq 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#:... | get_eq(): number[] {
return nativeModule.get_eq()
} | https://github.com/Nekofox-POT/LinMusic | 2d5a7f68f2368ebd5111a54c99b743d8f97dd13e | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/VocabularyTracker.ets | arkts | getLearningWords | 获取学习中的词汇 | getLearningWords(): VocabularyRecord[] {
return this.getRecordsByStatus(WordStatus.LEARNING);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getLearningWords 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#:#Le... | getLearningWords(): VocabularyRecord[] {
return this.getRecordsByStatus(WordStatus.LEARNING);
} | https://github.com/CLMC2025/Vignette | 80be2a82052c1bc67e3fc8b898aa5509763d31ca | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/WakeOnLan.ets | arkts | resolveAddress | ==================== DNS 解析 ====================
解析地址为 IP 列表(类似 Java InetAddress.getAllByName)
纯 IP 地址直接返回,域名通过系统 DNS 解析 | private static async resolveAddress(address: string): Promise<string[]> {
// 纯 IPv4 或 IPv6 地址直接返回
if (WakeOnLan.isIPAddress(address)) {
return [address];
}
// 域名 → DNS 解析(connection 模块级方法)
const result: connection.NetAddress[] = await connection.getAddressesByName(address);
const resolve... | 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 resolveAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left address AST#ide... | private static async resolveAddress(address: string): Promise<string[]> {
// 纯 IPv4 或 IPv6 地址直接返回
if (WakeOnLan.isIPAddress(address)) {
return [address];
}
// 域名 → DNS 解析(connection 模块级方法)
const result: connection.NetAddress[] = await connection.getAddressesByName(address);
const resolve... | https://github.com/AlkaidLab/moonlight-harmony | 91f1af539aed1ba423891c2458846f33565c03df | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/VoiceGuide.ets | arkts | isCurrentlySpeaking | 获取播报状态 | public isCurrentlySpeaking(): boolean {
return this.isSpeaking;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCurrentlySpeaking 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 boole... | public isCurrentlySpeaking(): boolean {
return this.isSpeaking;
} | https://github.com/LJ666-ui/harmony-health-care | b511693df41accfc0e3b175e8cc76ce45523d982 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.