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 |
|---|---|---|---|---|---|---|---|---|---|---|
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | initializeScanning | 初始化扫描功能 | private async initializeScanning(): Promise<void> {
try {
// 注册设备发现回调
this.registerDeviceFoundCallback();
// 开始扫描
await this.startScan();
hilog.info(this.domainId, this.logTag, 'SsapManager initialized and scanning started');
} catch (error) {
hilog.error(this.domainId, t... | 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 initializeScanning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async initializeScanning(): Promise<void> {
try {
// 注册设备发现回调
this.registerDeviceFoundCallback();
// 开始扫描
await this.startScan();
hilog.info(this.domainId, this.logTag, 'SsapManager initialized and scanning started');
} catch (error) {
hilog.error(this.domainId, t... | https://github.com/lidaixian999/Smart_Car | 009aee8f026c1763e986a305e96a024fd7a2abc5 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/PanZoomHandler.ets | arkts | distance | 计算两点间距离 | private distance(x1: number, y1: number, x2: number, y2: number): number {
const dx = x1 - x2;
const dy = y1 - y2;
return Math.sqrt(dx * dx + dy * dy);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left distance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | private distance(x1: number, y1: number, x2: number, y2: number): number {
const dx = x1 - x2;
const dy = y1 - y2;
return Math.sqrt(dx * dx + dy * dy);
} | https://github.com/AlkaidLab/moonlight-harmony | efd6d0b6344ec57bf4cb073d8a70202604615a81 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | decimalPlaces | Return the number of decimal places of the value of this Decimal.
@returns { double } the number type | public decimalPlaces(): double {
let digits = this.digits;
let result: double = NaN;
if (digits) {
let len = digits!.length - 1;
result = (len - Math.floor(this.exponent / LOG_BASE)) * LOG_BASE;
let value = digits!.at(len);
if (value) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left decimalPlaces 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 double A... | public decimalPlaces(): double {
let digits = this.digits;
let result: double = NaN;
if (digits) {
let len = digits!.length - 1;
result = (len - Math.floor(this.exponent / LOG_BASE)) * LOG_BASE;
let value = digits!.at(len);
if (value) {
... | https://gitcode.com/iop123123/arkts-static-skills | 61530af4d1ff632852c42243a19b4ee308513ec5 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | resetReleasedUsbDevices | 尝试重置已释放的 USB 设备,使系统 HID 驱动重新绑定
工作原理:
1. 重新连接设备获取文件描述符
2. 通过 ioctl(USBDEVFS_IOCTL + USBDEVFS_CONNECT) 通知内核重绑定接口驱动
等价于 libusb_attach_kernel_driver()
3. 如果 CONNECT 失败,后备方案使用 USBDEVFS_RESET 重置设备 | private resetReleasedUsbDevices(releasedKeys: Set<string>): void {
// 如果服务已重新启动,跳过重置(避免干扰新会话的 USB 接口声明)
if (this.started) {
console.info(`${TAG} 服务已重新启动,跳过 USB 设备内核驱动重绑定`);
return;
}
if (!usbHelper) {
console.warn(`${TAG} UsbHelper native 模块不可用,无法重绑定内核驱动`);
return;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetReleasedUsbDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left releasedKeys AST#identifier#Right AST#ERROR#Left AST#:#Le... | private resetReleasedUsbDevices(releasedKeys: Set<string>): void {
// 如果服务已重新启动,跳过重置(避免干扰新会话的 USB 接口声明)
if (this.started) {
console.info(`${TAG} 服务已重新启动,跳过 USB 设备内核驱动重绑定`);
return;
}
if (!usbHelper) {
console.warn(`${TAG} UsbHelper native 模块不可用,无法重绑定内核驱动`);
return;
}
... | https://github.com/AlkaidLab/moonlight-harmony | efaa8f12878a754101f8fcddff3f92009d9cf23b | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootUserInjection | 测试通道:want.parameters.bootUser=login,
HomePage 启动后会读取该值并 push 到 UserDetailPage,方便对详情页做真机回归。 | private handleBootUserInjection(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_USER];
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 handleBootUserInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private handleBootUserInjection(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_USER];
if (typeof raw !== 'string') {
return;
}
... | https://github.com/CarGuo/GSYGithubAppOH | f04fc7168ca3800ae7c6ce332dcade618113dab0 | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/pages/LoginPage.ets | arkts | showToast | 通用 Toast 提示 | showToast(msg: string) {
try {
promptAction.showToast({
message: msg,
duration: 2000,
bottom: 100
});
} catch (error) {
console.error(`[LoginPage] showToast error: ${JSON.stringify(error)}`);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#... | showToast(msg: string) {
try {
promptAction.showToast({
message: msg,
duration: 2000,
bottom: 100
});
} catch (error) {
console.error(`[LoginPage] showToast error: ${JSON.stringify(error)}`);
}
} | https://gitcode.com/openharmony/codelabs | 5e5bd304ab7c6afcbfac85cf16b9f2b124fede4e | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/model/ConfigInitializer.ets | arkts | isGlobalPopCallbackEnabled | 是否启用页面返回回调,默认为false
ZRouter.getInstance().pop() 会触发setPopListener回调
等同于 ZRouter.getInstance().popWithResult()
@param value | public set isGlobalPopCallbackEnabled(value: boolean) {
this._isGlobalPopCallbackEnabled = value
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left set AST#identifier#Right AST#call_expression#Left AST#identifier#Left isGlobalPopCallbackEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#... | public set isGlobalPopCallbackEnabled(value: boolean) {
this._isGlobalPopCallbackEnabled = value
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/ConfigInitializer.ets#L56-L58 | 83d5e3b448115fe4f01a65522db2d02662127c5b | github |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | products/phone/src/main/ets/pages/customScan/model/DeviceService.ets | arkts | selectSuitableRatio | Match a proper portrait resolution based on the device width and height. | public static selectSuitableRatio(): void {
Logger.info(TAG, 'Start to select suitable portraitRatio.');
let suitableRatio: number = 9 / 16;
let portraitRatio: number;
if (DeviceService.widthPX === 0 || DeviceService.heightPX === 0) {
Logger.info(TAG,
`The width or height of the display ... | 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 selectSuitableRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public static selectSuitableRatio(): void {
Logger.info(TAG, 'Start to select suitable portraitRatio.');
let suitableRatio: number = 9 / 16;
let portraitRatio: number;
if (DeviceService.widthPX === 0 || DeviceService.heightPX === 0) {
Logger.info(TAG,
`The width or height of the display ... | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | afc37af15adac5e168aac2154acbc61f78ef2a8a | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/LayoutsSettings.ets | arkts | build | ============================================================================
构建 UI
============================================================================ | build() {
Stack() {
if (this.mode === PageMode.LIST) {
WaveBackground({ themeColors: this.themeColors, isPlaying: this.isWaveAnimationPlaying })
}
Column() {
if (this.mode === PageMode.LIST) {
this.ListModeUI()
} else {
this.EditorModeUI()
}
... | 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() {
if (this.mode === PageMode.LIST) {
WaveBackground({ themeColors: this.themeColors, isPlaying: this.isWaveAnimationPlaying })
}
Column() {
if (this.mode === PageMode.LIST) {
this.ListModeUI()
} else {
this.EditorModeUI()
}
... | https://github.com/richshaw2015/nds | 473538edf8635c374bcb2993715d95aac5dbbfde | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/Xbox360Controller.ets | arkts | unsignByte | 无符号字节转换 | private unsignByte(b: number): number {
return b & 0xFF;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left unsignByte AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left b AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | private unsignByte(b: number): number {
return b & 0xFF;
} | https://github.com/AlkaidLab/moonlight-harmony | 5e362aae17d8edc1f5cad2e234045a29186e005a | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/HomeViewModel.ets | arkts | mergeAndLimitRecommendedNovels | 小说合并去重 | private mergeAndLimitRecommendedNovels(newNovels: PixivNovel[]) {
if (newNovels.length === 0) return;
const uniqueMap = new Map<number, PixivNovel>();
this.recommendedNovels.forEach(n => uniqueMap.set(n.id, n));
newNovels.forEach(n => { if (!uniqueMap.has(n.id)) uniqueMap.set(n.id, n); });
this.re... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeAndLimitRecommendedNovels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newNovels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | private mergeAndLimitRecommendedNovels(newNovels: PixivNovel[]) {
if (newNovels.length === 0) return;
const uniqueMap = new Map<number, PixivNovel>();
this.recommendedNovels.forEach(n => uniqueMap.set(n.id, n));
newNovels.forEach(n => { if (!uniqueMap.has(n.id)) uniqueMap.set(n.id, n); });
this.re... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/HomeViewModel.ets#L158-L164 | 3e3f83b11df1207cacb335b7216456d271cd696f | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | exit | Image edit model exit.
@returns | exit(): ImageFilterCrop | undefined {
Logger.info(TAG, 'exit');
this.saveFinalOperation();
this.isCropShowInitialized = false;
this.input = undefined;
if (this.couldReset()) {
this.clear();
} else {
this.filter = undefined;
}
return this.filter;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exit 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#binary_expression#Left AST#... | exit(): ImageFilterCrop | undefined {
Logger.info(TAG, 'exit');
this.saveFinalOperation();
this.isCropShowInitialized = false;
this.input = undefined;
if (this.couldReset()) {
this.clear();
} else {
this.filter = undefined;
}
return this.filter;
} | https://gitee.com/openharmony/codelabs.git | 86fc9fa4f3203880e8c2a79551dae0532a4bd623 | gitee |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | setMaxRequests | 设置最大请求数量
@param concurrency 请求数量 | public setMaxRequests(concurrency: number): void {
nativeNode.setMaxRequests(concurrency);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaxRequests AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left concurrency AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | public setMaxRequests(concurrency: number): void {
nativeNode.setMaxRequests(concurrency);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L90-L92 | c680eefab91eee34734fca5cc7e6ee739ba97ac1 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/apis/IBestImagePreview.ets | arkts | getScaleImageInfo | 获取缩放后图片信息 | getScaleImageInfo(): ScaleImageInfo {
let scaleWidth = this.imgWidth * this.curScale
let scaleHeight = this.imgHeight * this.curScale
return {
width: scaleWidth,
height: scaleHeight,
localLeft: (this.rootWidth - scaleWidth) / 2,
localTop: (this.rootHeight - scaleHeight) / 2
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getScaleImageInfo 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 ScaleImageInfo AST#identifier#Right AST#ERRO... | getScaleImageInfo(): ScaleImageInfo {
let scaleWidth = this.imgWidth * this.curScale
let scaleHeight = this.imgHeight * this.curScale
return {
width: scaleWidth,
height: scaleHeight,
localLeft: (this.rootWidth - scaleWidth) / 2,
localTop: (this.rootHeight - scaleHeight) / 2
}
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestImagePreview.ets#L243-L252 | 5692f96f2ff2aaa628862fc87e95a6e13cee7f25 | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/RdbHelper.ets | arkts | queryAll | query record.
@param callback callback for expression result set. | async queryAll(callback: Function): Promise<void> {
await this.getRdbStore();
if (this.rdbStore === null) {
LogUtil.error(TAG, 'rdbStore is null, query fail.');
callback([]);
return;
}
try {
let predicatesV9: relationalStore.RdbPredicates =
new relationalStore.RdbPredic... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callback AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async queryAll(callback: Function): Promise<void> {
await this.getRdbStore();
if (this.rdbStore === null) {
LogUtil.error(TAG, 'rdbStore is null, query fail.');
callback([]);
return;
}
try {
let predicatesV9: relationalStore.RdbPredicates =
new relationalStore.RdbPredic... | https://gitee.com/openharmony-sig/applications_calculator.git | 8ab63e808eae0beadcf8f3cabd932b4da88c8611 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | creates a new BigInt64Array from current BigInt64Array based on a condition fn
@param fn the condition to apply for each element
@returns a new BigInt64Array with elements from current BigInt64Array that satisfy condition fn | public filter(fn: (val: long, index: int) => boolean): BigInt64Array {
let newF: (val: long, index: int, array: BigInt64Array) => boolean =
(val: long, index: int, array: BigInt64Array): boolean => { return fn(val, index) }
return this.filter(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: long, index: int) => boolean): BigInt64Array {
let newF: (val: long, index: int, array: BigInt64Array) => boolean =
(val: long, index: int, array: BigInt64Array): boolean => { return fn(val, index) }
return this.filter(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e9fcd61f07c80e45fef57649f3f19cdf155dfa50 | gitee |
JackJiang2011/harmonychat | entry/src/main/ets/pages/ChatPage.ets | arkts | aboutToAppear | 生命周期中只被调用一次,类似于iOS中的viewDidLoad、Android中的onCreate. | aboutToAppear() {
// 添加事件通知
this.addEvents();
// 添加一条预定义的系统消息在列表列表里
IMClientManager.getInstance().getMessageProvider().addSystemMessage('当前通信层,基于鸿蒙NEXT原生WebSocket');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 添加事件通知
this.addEvents();
// 添加一条预定义的系统消息在列表列表里
IMClientManager.getInstance().getMessageProvider().addSystemMessage('当前通信层,基于鸿蒙NEXT原生WebSocket');
} | https://github.com/JackJiang2011/harmonychat | e07662bb73b9b66178b9bbdfa185ba6226ed3ebb | github |
the-wwyang/kids-learning-app | src/main/ets/storage/DataStorageManager.ets | arkts | initialize | 初始化存储管理器
@param context 应用上下文 | async initialize(context: Context): Promise<void> {
this.context = context;
console.log('[DataStorageManager] Initialized with context');
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left c... | async initialize(context: Context): Promise<void> {
this.context = context;
console.log('[DataStorageManager] Initialized with context');
} | https://github.com/the-wwyang/kids-learning-app | e1808bf3d8e8feff6922516eaf7808ecdc997fba | github |
erosTeam/NextE | shared/src/main/ets/i18n/EhErrorText.ets | arkts | message | Localized message for a classified kind. | static message(kind: EhErrorKind): string {
return AppStrings.get(EhErrorText.keyFor(kind))
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left message AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kind AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EhErrorK... | static message(kind: EhErrorKind): string {
return AppStrings.get(EhErrorText.keyFor(kind))
} | https://github.com/erosTeam/NextE | ce3ae55c87a200b85d2c193fa1d9e431511dd5f9 | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets | arkts | evaluateBloodPressure | 评估血压风险 | private static evaluateBloodPressure(value: number): RiskFactor {
let score = 0;
let level: 'low' | 'medium' | 'high' | 'very_high' = 'low';
if (value >= 180) { score = 100; level = 'very_high'; }
else if (value >= 140) { score = 75; level = 'high'; }
else if (value >= 130) { score = 50; leve... | 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 evaluateBloodPressure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST... | private static evaluateBloodPressure(value: number): RiskFactor {
let score = 0;
let level: 'low' | 'medium' | 'high' | 'very_high' = 'low';
if (value >= 180) { score = 100; level = 'very_high'; }
else if (value >= 140) { score = 75; level = 'high'; }
else if (value >= 130) { score = 50; leve... | https://github.com/LJ666-ui/harmony-health-care | f72cbefdcba3ede651a01c01fe49d515f626b7d7 | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | analyzeIndentGuides | Perform indent guide analysis on a text.
@param text Full text content
@returns Indent guide analysis result | public analyzeIndentGuides(text: string): IndentGuideResult {
if (this.nativeHandle == 0) {
return new IndentGuideResult();
}
let buffer: Int32Array = lib.TextAnalyzer_AnalyzeIndentGuides(this.nativeHandle, text);
return NativeBufferPack.readIndentGuideResult(buffer);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeIndentGuides AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public analyzeIndentGuides(text: string): IndentGuideResult {
if (this.nativeHandle == 0) {
return new IndentGuideResult();
}
let buffer: Int32Array = lib.TextAnalyzer_AnalyzeIndentGuides(this.nativeHandle, text);
return NativeBufferPack.readIndentGuideResult(buffer);
} | https://github.com/FinalScave/SweetLine | 31f39e21e1eae85e030e7afe05061b9e0223e633 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | getFromDiskCache | 从磁盘缓存获取图片 | private async getFromDiskCache(cacheKey: string, options?: LoadOptions): Promise<image.PixelMap | null> {
try {
const cacheInfo = this.diskCacheIndex.get(cacheKey);
if (!cacheInfo) {
return null;
}
// 检查文件是否存在
if (!await this.sandboxManager.exists(cacheInfo.filePath)) ... | 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 getFromDiskCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheKey AST#identifier#Right AST#ERROR#Left AST#:#... | private async getFromDiskCache(cacheKey: string, options?: LoadOptions): Promise<image.PixelMap | null> {
try {
const cacheInfo = this.diskCacheIndex.get(cacheKey);
if (!cacheInfo) {
return null;
}
// 检查文件是否存在
if (!await this.sandboxManager.exists(cacheInfo.filePath)) ... | https://github.com/DaLongZhuaZi/manxia | 71dcd5693ef944caf5e20e8e8ea4fd407c477203 | github |
Octo-o-o-o/harmonyos-ai-workspace | samples/templates/huks-secure-store/SecureStore.ets | arkts | findHuksBytesParam | 从 HUKS finishSession 返回的 properties 里取某个 tag 的 bytes(找不到返回 null) | function findHuksBytesParam(params: Array<huks.HuksParam> | undefined, tag: huks.HuksTag): Uint8Array | null {
if (!params) {
return null
}
for (let i = 0; i < params.length; i++) {
const value = params[i].value
if (params[i].tag === tag && value instanceof Uint8Array) {
return value
}
}
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left findHuksBytesParam AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function findHuksBytesParam(params: Array<huks.HuksParam> | undefined, tag: huks.HuksTag): Uint8Array | null {
if (!params) {
return null
}
for (let i = 0; i < params.length; i++) {
const value = params[i].value
if (params[i].tag === tag && value instanceof Uint8Array) {
return value
}
}
... | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | 1cc048caa79fa91bc5e49f27f598bac08705c099 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Copies all elements of arr to the current Uint8Array starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
public | /* public */ internal set(arr: number[], insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8Array.length")
}
for (let i = 0; i < arr.length; ++i) {
... | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#id... | /* public */ internal set(arr: number[], insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8Array.length")
}
for (let i = 0; i < arr.length; ++i) {
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | dec10b98d90c57aaa8e76f065d0a4126660a99d6 | gitee |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/AbsDanmakuSync.ets | arkts | isSyncPlayingState | synchronize pause/resume state with outside playback
@return | public isSyncPlayingState(): boolean {
return false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSyncPlayingState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolea... | public isSyncPlayingState(): boolean {
return false;
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 195e5133b7322a0df1cd1882d8623fcbb107f682 | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets | arkts | formatDate | 格式化日期为字符串 | formatDate(date: Date): string {
return `${this.monthNames[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date AST#identifier#Right AST#)#Left ) AST#)#... | formatDate(date: Date): string {
return `${this.monthNames[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`
} | https://gitcode.com/openharmony/codelabs | fd3c358705e53d5312d9ecce567bf4cf802eac71 | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/ExternalFileOpener.ets | arkts | getDirectoryPath | 获取文件所在目录路径 | static getDirectoryPath(filePath: string): string {
const lastSlash = filePath.lastIndexOf('/');
return lastSlash === -1 ? '' : filePath.substring(0, lastSlash);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDirectoryPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static getDirectoryPath(filePath: string): string {
const lastSlash = filePath.lastIndexOf('/');
return lastSlash === -1 ? '' : filePath.substring(0, lastSlash);
} | https://github.com/XJTUWYD/ArkDiff | d97cf2db65250d856fec4d774b1e4f9ca3f9743f | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | getComponent | Gets or creates a component | getComponent(componentId: string, componentType: string = ''): Component {
if (!this._componentTree[componentId]) {
this._componentTree[componentId] = new Component(this, componentId, componentType);
}
return this._componentTree[componentId];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getComponent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST... | getComponent(componentId: string, componentType: string = ''): Component {
if (!this._componentTree[componentId]) {
this._componentTree[componentId] = new Component(this, componentId, componentType);
}
return this._componentTree[componentId];
} | https://github.com/AGenUI/AGenUI | 8f7f51566b4d99c84537d0740bbb3c5b42be46f5 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | redirectForResult2 | @deprecated
@see {ZRouter.getInstance().redirectForResult2}
@param name
@param param
@param callback | public static redirectForResult2<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>) {
ZRouter.getRouterMgr().redirectForResult2(name, param, callback)
} | 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 redirectForResult2 AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#... | public static redirectForResult2<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>) {
ZRouter.getRouterMgr().redirectForResult2(name, param, callback)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L418-L420 | 9cf5f40facaa2787d448ab0f23e473c11866a529 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | parseQRCodeImageWithNameFromCamera | 解析从相机获取的二维码图片,指定文件名称
@param cameraService
@param canvasContext | parseQRCodeImageWithNameFromCamera(cameraService: CameraService,
imageComponentType?: image.ComponentType): void {
Logger.info("parseQRCodeImageWithNameFromCamera...")
cameraService.imageReceiver.on('imageArrival', async () => {
Logger.info("parseQRCodeImageWithNameF... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parseQRCodeImageWithNameFromCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cameraService AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CameraServic... | parseQRCodeImageWithNameFromCamera(cameraService: CameraService,
imageComponentType?: image.ComponentType): void {
Logger.info("parseQRCodeImageWithNameFromCamera...")
cameraService.imageReceiver.on('imageArrival', async () => {
Logger.info("parseQRCodeImageWithNameF... | https://github.com/openharmony/applications_app_samples | f1a11114c736de2d83054a6f4b87683e5c0a7815 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getResponsiveFontSize | 根据基础字号计算响应式字号 | public static getResponsiveFontSize(baseFontSize: number): number {
return Math.round(baseFontSize * ResponsiveLayoutHelper.getFontScale());
} | 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 getResponsiveFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseFontSize AST#identifier#Right AST#ERROR#Left... | public static getResponsiveFontSize(baseFontSize: number): number {
return Math.round(baseFontSize * ResponsiveLayoutHelper.getFontScale());
} | https://github.com/DaLongZhuaZi/manxia | 72d1923d1d8b4c504d0e8d649c48bf1f97a64f41 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets | arkts | initLeftTop | Initialize the map.
@param mapContext This object of MapComponent. | initLeftTop(screenMapWidth: number, mapWidth: number): void {
this.leftTop = [(screenMapWidth - mapWidth), 0];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initLeftTop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left screenMapWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , A... | initLeftTop(screenMapWidth: number, mapWidth: number): void {
this.leftTop = [(screenMapWidth - mapWidth), 0];
} | https://gitee.com/harmonyos/codelabs.git | d4eb5f0ecac331368c069f85bcda10537ceace34 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/slider/index.ets | arkts | format | 根据步数格式化值 | format(value: number): number{
const min = +this.min
const max = +this.max
const step = +this.step
value = clamp(value, min, max)
return addNumber(min, Math.round((value - min) / step) * step)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left format AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#R... | format(value: number): number{
const min = +this.min
const max = +this.max
const step = +this.step
value = clamp(value, min, max)
return addNumber(min, Math.round((value - min) / step) * step)
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/slider/index.ets#L207-L213 | 4ba7c9994d7d208dcf0e8906fc6556771db947e7 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | 应用在后台,接收外部应用拉起或者华为分享拉起 | async onNewWant(want: Want) {
WantProcessUtil.want = want
salmonLogger.addLog(TAG, `onNewWant, want: ${want.abilityName}`)
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onNewWant AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left want AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async onNewWant(want: Want) {
WantProcessUtil.want = want
salmonLogger.addLog(TAG, `onNewWant, want: ${want.abilityName}`)
} | https://github.com/Yebingiscn/SweetVideo | 07e58eaca79d82cc022fdb30dda1bd10a71eeb15 | github |
HarmonyOS_Samples/guide-snippets | Ability/UIAbilityLifecycle/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | [EndExclude onCreate]
[StartExclude onWindowStageWillDestroy] | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 执行UIAbility整个生命周期中仅发生一次的业务逻辑
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 执行UIAbility整个生命周期中仅发生一次的业务逻辑
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 950fc1932a0581444dfcdbe199dfab6e11eb7c68 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/FavoriteModelsService.ets | arkts | getFavorites | 获取所有收藏的模型
@returns 收藏模型列表 | getFavorites(): FavoriteModel[] {
return this.favoriteModels.slice() // 返回副本
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | getFavorites(): FavoriteModel[] {
return this.favoriteModels.slice() // 返回副本
} | https://github.com/LongLiveY96/chatcube | cb7e103aa325d60b747db46fa157413c26fb60ea | github |
HarmonyOS_Samples/MusicHome | products/default/src/main/ets/pages/Index.ets | arkts | build | Root UI: {@link HdsNavigation} with tabs and optional playback cover. | build() {
HdsNavigation(this.pageIndexInfos) {
if (deviceInfo.distributionOSApiVersion >= 60100) {
HdsTabs({ barPosition: BarPosition.End }) {
this.HomeTabsPages()
}
.barMode(BarMode.Fixed)
.barHeight(56)
.zIndex(1)
.barOverlap(true)
.barPosi... | 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() {
HdsNavigation(this.pageIndexInfos) {
if (deviceInfo.distributionOSApiVersion >= 60100) {
HdsTabs({ barPosition: BarPosition.End }) {
this.HomeTabsPages()
}
.barMode(BarMode.Fixed)
.barHeight(56)
.zIndex(1)
.barOverlap(true)
.barPosi... | https://gitcode.com/HarmonyOS_Samples/MusicHome | ee3e6ea78b8448752085413ec3eadf41abbe2aa7 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets | arkts | generateKeyArray | Generates a string key array starting from 0 and incrementing based on the given length.
@param { Number } length Length of the array.
@returns { string[] } Generated string key array. | private static generateKeyArray(length: Number): string[] {
const len = length.toInt();
if (len == 0) {
return new string[0]("")
}
let res: string[] = new string[len]("")
for (let i = 0; i < len; i++) {
res[i] = i.toString()
}
return re... | 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 generateKeyArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#L... | private static generateKeyArray(length: Number): string[] {
const len = length.toInt();
if (len == 0) {
return new string[0]("")
}
let res: string[] = new string[len]("")
for (let i = 0; i < len; i++) {
res[i] = i.toString()
}
return re... | https://gitcode.com/iop123123/arkts-static-skills | cab4e6b67ba395f5cfde317f506b34708a540201 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/LinkedBlockingQueue.ets | arkts | poll | The poll operation. Pop one element and return it if the queue is not empty.
Returns undefined when the queue is empty. No blocking.
@returns { T | undefined } the deleted element or undefined when the queue is empty. | override poll(): T | undefined {
if (this.atomicsGetSize() == 0) {
return undefined;
}
let c: int = -1;
ConcurrencyHelpers.mutexLock(this.popMutex);
try {
if (this.atomicsGetSize() > 0) {
let firstNod... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left poll AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#c... | override poll(): T | undefined {
if (this.atomicsGetSize() == 0) {
return undefined;
}
let c: int = -1;
ConcurrencyHelpers.mutexLock(this.popMutex);
try {
if (this.atomicsGetSize() > 0) {
let firstNod... | https://gitcode.com/iop123123/arkts-static-skills | e42848ac08fca54ee24fa756a6f768903a1c7e81 | gitcode |
openharmony-sig/knowledge_demo_travel | FA/GreyWolf_ParkingManageSys_FA/entry/src/main/ets/MainAbility/common/TabsNavigation.ets | arkts | build | 分组 用于显示页签 | build() {
Flex({alignContent:FlexAlign.Center}) {
Row() {
ForEach(this.groups, (item: string,index:number) => {
Text(item.toString() + '门')
.width(130)
.fontSize(index === this.tabIndex ? 36 : 32)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Flex({alignContent:FlexAlign.Center}) {
Row() {
ForEach(this.groups, (item: string,index:number) => {
Text(item.toString() + '门')
.width(130)
.fontSize(index === this.tabIndex ? 36 : 32)
... | https://gitee.com/openharmony-sig/knowledge_demo_travel.git | deac4e9dbf7f922e9699752c6d2deb52656f32ce | gitee |
HarmonyOS_Samples/BestPracticeSnippets | LoadPerformanceInWeb/entry/src/main/ets/pages/SetSchemeHandler.ets | arkts | onCreate | [Start set_scheme_handler]
EntryAbility.ets | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// register CustomSchemes
testNapi.registerCustomSchemes();
// initializeWebEngine
webview.WebviewController.initializeWebEngine();
// set SchemeHandler。
testNapi.setSchemeHandler();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// register CustomSchemes
testNapi.registerCustomSchemes();
// initializeWebEngine
webview.WebviewController.initializeWebEngine();
// set SchemeHandler。
testNapi.setSchemeHandler();
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | d0611eac7b6a8836a5eae3aeac98c28e7870a84a | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/WebUploadServer.ets | arkts | uint8ArrayToString | Uint8Array 转字符串(仅用于 ASCII/UTF-8 文本) | private uint8ArrayToString(data: Uint8Array): string {
const decoder = new util.TextDecoder('utf-8');
return decoder.decodeToString(data);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left uint8ArrayToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private uint8ArrayToString(data: Uint8Array): string {
const decoder = new util.TextDecoder('utf-8');
return decoder.decodeToString(data);
} | https://github.com/richshaw2015/nds | b4addc36b52eb54068b2a79d43ef7a1b4393681b | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | autoInitialize | 自动初始化(使用内置医院数据)
如果已经初始化则直接返回 | public async autoInitialize(): Promise<void> {
if (this.isInitialized) {
console.log('[PathPlanner] 已初始化,跳过重复初始化');
return;
}
if (this.initializationPromise) {
console.log('[PathPlanner] 等待初始化完成...');
return this.initializationPromise;
}
this.initializationPromise = this.... | 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 autoInitialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async autoInitialize(): Promise<void> {
if (this.isInitialized) {
console.log('[PathPlanner] 已初始化,跳过重复初始化');
return;
}
if (this.initializationPromise) {
console.log('[PathPlanner] 等待初始化完成...');
return this.initializationPromise;
}
this.initializationPromise = this.... | https://github.com/LJ666-ui/harmony-health-care | 7f07d1a125c86f39b427081bb2fa4e67b2ca1499 | github |
apap6628114/nga_oh | entry/src/main/ets/parser/bbcode/lexer.ets | arkts | preprocessContent | 预处理原始内容:还原转义的中括号、规范化 blockquote/a/img 标签为 BBCode。 | function preprocessContent(s: string): string {
return s
.replace(/[/g, '[')
.replace(/]/g, ']')
.replace(/<blockquote[^>]*>/gi, '[quote]')
.replace(/<\/blockquote>/gi, '[/quote]')
.replace(/<a\s+href="(https?:\/\/[^"]+)"[^>]*>(.*?)<\/a>/gi, '[url=$1]$2[/url]')
.replace(/<img[^>]+class... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left preprocessContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function preprocessContent(s: string): string {
return s
.replace(/[/g, '[')
.replace(/]/g, ']')
.replace(/<blockquote[^>]*>/gi, '[quote]')
.replace(/<\/blockquote>/gi, '[/quote]')
.replace(/<a\s+href="(https?:\/\/[^"]+)"[^>]*>(.*?)<\/a>/gi, '[url=$1]$2[/url]')
.replace(/<img[^>]+class... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/bbcode/lexer.ets#L92-L108 | e47a6c316627e399aef018dbcba9d9f22e31efa3 | github |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | products/phone/src/main/ets/pages/customScan/model/ScanLayout.ets | arkts | getInstance | Window height. | static getInstance(): ScanLayout {
ScanLayout.instance ||= new ScanLayout();
return ScanLayout.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 ScanLayout... | static getInstance(): ScanLayout {
ScanLayout.instance ||= new ScanLayout();
return ScanLayout.instance;
} | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | 562d0dc3d1b1dd39f1969d499a77c523f0520be4 | gitcode |
Jiagu1218/mrpohos | entry/src/main/ets/pages/OpenSourceNotices.ets | arkts | getLicenseBgColor | 根据许可证类型返回背景颜色 | getLicenseBgColor(license: string): string {
if (license.includes('GPL-3.0')) {
return '#2d1f1f';
} else if (license.includes('GPL-2.0')) {
return '#2d261f';
} else if (license.includes('LGPL')) {
return '#1f2d22';
} else if (license.includes('BSD')) {
return '#1f262d';
} e... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLicenseBgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left license AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AS... | getLicenseBgColor(license: string): string {
if (license.includes('GPL-3.0')) {
return '#2d1f1f';
} else if (license.includes('GPL-2.0')) {
return '#2d261f';
} else if (license.includes('LGPL')) {
return '#1f2d22';
} else if (license.includes('BSD')) {
return '#1f262d';
} e... | https://github.com/Jiagu1218/mrpohos | bcfcf5db5d86b5b55f022ae234cbe9cc3faa696f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/IndoorLocator.ets | arkts | handlePositioningError | 处理定位错误 | private handlePositioningError(error: Error | string): void {
// 使用最后已知位置
if (this.positionHistory.length > 0) {
const lastResult = this.positionHistory[this.positionHistory.length - 1];
this.currentPosition = lastResult.position;
this.signalStrength = SignalStrength.WEAK;
console.warn... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handlePositioningError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binar... | private handlePositioningError(error: Error | string): void {
// 使用最后已知位置
if (this.positionHistory.length > 0) {
const lastResult = this.positionHistory[this.positionHistory.length - 1];
this.currentPosition = lastResult.position;
this.signalStrength = SignalStrength.WEAK;
console.warn... | https://github.com/LJ666-ui/harmony-health-care | f390e9562e96af8f76d93808133935a630a511d9 | github |
RoooyHe/toona-ohos | toona/src/main/ets/pages/SpacePage.ets | arkts | navigateToSpaceDetail | 移除了多余的安全校验,直接使用 MainPage 传递进来的 pathStack 进行跳转 | navigateToSpaceDetail(space: Room) {
if (!this.pathStack) {
return;
}
const param: Record<string, Object> = {
"spaceId": space.id,
"spaceName": space.getDisplayName()
};
this.pathStack.pushPathByName('SpaceDetailPage', param);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left navigateToSpaceDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left space AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Room AST#identifier#Right AST#ERRO... | navigateToSpaceDetail(space: Room) {
if (!this.pathStack) {
return;
}
const param: Record<string, Object> = {
"spaceId": space.id,
"spaceName": space.getDisplayName()
};
this.pathStack.pushPathByName('SpaceDetailPage', param);
} | https://github.com/RoooyHe/toona-ohos | edce8801715803660f7a239ac329b35a60827a8c | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/UserLibraryApi.ets | arkts | getItem | Gets an item from a user's library.
@summary Gets an item from a user\'s library.
@param {UserLibraryApiGetItemRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserLibraryApi | public async getItem(requestParameters: UserLibraryApiGetItemRequest): Promise<BaseItemDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}`, parameters: requestParameters, excludeParams: ['itemId']})
} | 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 getItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Lef... | public async getItem(requestParameters: UserLibraryApiGetItemRequest): Promise<BaseItemDto> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}`, parameters: requestParameters, excludeParams: ['itemId']})
} | https://github.com/OHPG/FinSdk | fee251f78df6af2a23a74a44a98360333622e674 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setDrawInside | sets whether the legend will draw inside the chart or outside
@param value | public setDrawInside(value: boolean): void {
this.mDrawInside = value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawInside 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 b... | public setDrawInside(value: boolean): void {
this.mDrawInside = value;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f93fd76eda78042704fead2db23595889617b87d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | findElementsByClass | 按class查找元素
增强版:支持多个class名称,添加诊断日志
添加性能保护:限制元素数量和内容大小以避免ANR | private findElementsByClass(content: string, className: string, maxElementsHint: number = 0): string[] {
const results: string[] = [];
const seenStartIndexes: Set<number> = new Set();
// 性能保护:使用统一配置
let maxElements = this.getMaxElements(PerformanceConfig.MAX_ELEMENTS);
if (maxElementsHint > 0... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findElementsByClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | private findElementsByClass(content: string, className: string, maxElementsHint: number = 0): string[] {
const results: string[] = [];
const seenStartIndexes: Set<number> = new Set();
// 性能保护:使用统一配置
let maxElements = this.getMaxElements(PerformanceConfig.MAX_ELEMENTS);
if (maxElementsHint > 0... | https://github.com/DaLongZhuaZi/manxia | 30fd2fa3427b510228e21ac9eaf16fb9deaed6d3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | codeUnitsToEncode | codeUnitsToEncode(UTF_16_CodePoint) counts a number of code units to encode the UTF-16 code point.
See UTF-16 for more details.
@param { UTF_16_CodePoint } value UTF-16 code point to be examinated.
@returns { int }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static codeUnitsToEncode(value: UTF_16_CodePoint): int {
if (Char.isInBasicMultilingualPlane(value)) {
return 1;
}
return 2;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left codeUnitsToEncode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left... | public static codeUnitsToEncode(value: UTF_16_CodePoint): int {
if (Char.isInBasicMultilingualPlane(value)) {
return 1;
}
return 2;
} | https://gitcode.com/iop123123/arkts-static-skills | d1d7c2ac619416e573bfef651b7c08a9efa34c90 | gitcode |
offlinecat-dev/OCNetORM | example/repository/UserRepository.ets | arkts | updateUser | 更新用户信息
@param id 用户ID
@param username 新用户名
@param email 新邮箱
@returns 保存结果 | async updateUser(id: number, username?: string, email?: string): Promise<SaveResult> {
const existingUser = await this.findById(id)
if (existingUser === null) {
return SaveResult.createFailure('用户不存在')
}
// 更新属性
if (username !== undefined) {
existingUser.setPropertyValue('username', u... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async updateUser(id: number, username?: string, email?: string): Promise<SaveResult> {
const existingUser = await this.findById(id)
if (existingUser === null) {
return SaveResult.createFailure('用户不存在')
}
// 更新属性
if (username !== undefined) {
existingUser.setPropertyValue('username', u... | https://github.com/offlinecat-dev/OCNetORM | 29a6de39464155709daa62b0f58147496060d236 | github |
openharmony-sig/flutter_sqflite | sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/Database.ets | arkts | query | / query | public static query(operation: Operation, db: relationalStore.RdbStore): void {
Database.doQuery(operation, db);
} | 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 query AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left operation ... | public static query(operation: Operation, db: relationalStore.RdbStore): void {
Database.doQuery(operation, db);
} | https://gitee.com/openharmony-sig/flutter_sqflite.git | dded30285c887ea77a130b336757553a4c058d96 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | setCurrentSearchContent | SEARCH
Sets the current search content of the window.
Also refreshes the keyword entries and / or destination on demand (passed in args).
@param newContent The new search content.
@param doKeywordRefresh Whether to refresh the keyword entries. | setCurrentSearchContent(newContent: string, doKeywordRefresh: boolean, doDestinationRefresh: boolean) {
this.addressBarContentMajor = newContent;
if (doKeywordRefresh) {
this.refreshKeywordEntries();
}
if (doDestinationRefresh) {
this.refreshDestination();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCurrentSearchContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERR... | setCurrentSearchContent(newContent: string, doKeywordRefresh: boolean, doDestinationRefresh: boolean) {
this.addressBarContentMajor = newContent;
if (doKeywordRefresh) {
this.refreshKeywordEntries();
}
if (doDestinationRefresh) {
this.refreshDestination();
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 69d2116c9362dcf81301fc144dc47d2df078d446 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/WebDavClient.ets | arkts | request | 发送请求
@param req
@returns | public async request(req: rcp.Request): Promise<ResultInfo> {
const requestReturn: ResultInfo = new ResultInfo();
let errorMessage: string | undefined = undefined;
try {
const resp = await this.session?.fetch(req);
errorMessage = resp?.toString() ?? undefined;
if (resp === undefined) {
... | 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 request AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left req AST#identifier#Right AST#:#Left : AST#:#Righ... | public async request(req: rcp.Request): Promise<ResultInfo> {
const requestReturn: ResultInfo = new ResultInfo();
let errorMessage: string | undefined = undefined;
try {
const resp = await this.session?.fetch(req);
errorMessage = resp?.toString() ?? undefined;
if (resp === undefined) {
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L125-L196 | dab3dcd295337d97f9da412dea1e971e3432bdfb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getTypeDesc | getTypeDesc
@returns {RuntimeTypeDescriptor}
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getTypeDesc(): RuntimeTypeDescriptor {
return this.td
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTypeDesc 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 RuntimeTyp... | public getTypeDesc(): RuntimeTypeDescriptor {
return this.td
} | https://gitcode.com/iop123123/arkts-static-skills | ea971473106d406863a6bd968ba63eb2d2d84158 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GamepadManager.ets | arkts | isConnected | 手柄是否已连接 | get isConnected(): boolean {
return this.connected
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isConnected 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#Ri... | get isConnected(): boolean {
return this.connected
} | https://github.com/richshaw2015/nds | bd902e5d7f99d5d8980c180a98a65fce1d77154f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/TokenManager.ets | arkts | isUserLoggedIn | 判断普通用户是否已登录 | static isUserLoggedIn(): boolean {
const isLoggedIn = SettingsUtil.get('isLoggedIn');
const token = SettingsUtil.get('token');
return isLoggedIn === true && token !== null && token !== '';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isUserLoggedIn 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 AS... | static isUserLoggedIn(): boolean {
const isLoggedIn = SettingsUtil.get('isLoggedIn');
const token = SettingsUtil.get('token');
return isLoggedIn === true && token !== null && token !== '';
} | https://github.com/LJ666-ui/harmony-health-care | 5e0777104847751ce80d31f304ee21be1ee9a94e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | createBigInt | Creates a new JSON element containing an bigint value.
@param {bigint} value - The bigint value to store
@returns {JsonElement} A new JsonElement containing the bigint value | static createBigInt(value: bigint): JsonElement {
const element = new JsonElement()
element.maybeBigIntValue = value
return element
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createBigInt 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 bi... | static createBigInt(value: bigint): JsonElement {
const element = new JsonElement()
element.maybeBigIntValue = value
return element
} | https://gitcode.com/iop123123/arkts-static-skills | a700fdeabd6af3d969f026946aa33db0ac9ca21e | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/CasLoginService.ets | arkts | injectXxcappSession | HTTP 走订水 OAuth → 拿 xxcapp session → 注入 WebView CookieJar
只需 xxcapp 这一个 cookie,不全量同步,轻量精准 | async injectXxcappSession(): Promise<void> {
console.info(TAG, 'injectXxcappSession: start');
try {
await this.http.get('https://order.xidian.edu.cn/mobile/thirdoauth/oauth2Xidian/1');
await this.http.saveCookies();
const xxcappCookies: string = this.http.getAllCookies('xxcapp.xidian.edu.cn'... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left injectXxcappSession 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#:#R... | async injectXxcappSession(): Promise<void> {
console.info(TAG, 'injectXxcappSession: start');
try {
await this.http.get('https://order.xidian.edu.cn/mobile/thirdoauth/oauth2Xidian/1');
await this.http.saveCookies();
const xxcappCookies: string = this.http.getAllCookies('xxcapp.xidian.edu.cn'... | https://github.com/PollenWang6/HiXD | 28578019d4d84b7f73ad4f16eceb5ea190e6cbe4 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPAuthManager.ets | arkts | getSession | 获取会话信息 | public getSession(vmName: string): RDPSession | undefined {
return this.sessions.get(vmName);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | public getSession(vmName: string): RDPSession | undefined {
return this.sessions.get(vmName);
} | https://github.com/AetheriumSimulator/qemu-hmos | 1885e37f11ce7a1ac9c22148951cf4407ce51362 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | sync | 同步多对多关联(替换所有关联)
删除源实体的所有现有关联,然后建立新的关联
@param sourceId 源实体主键值
@param targetIds 目标实体主键值数组
@param relationName 关联属性名
@returns Promise<SaveResult>
@throws RelationNotFoundError 如果关联关系未注册
Requirements: 5.7 | async sync(sourceId: ValueType, targetIds: Array<ValueType>, relationName: string): Promise<SaveResult> {
this.ensureWritePathAllowed('SYNC')
return await this.withSessionStore(async (repo) => {
const result = await repo.relationManager.sync(sourceId, targetIds, relationName)
return repo.ensureSav... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#... | async sync(sourceId: ValueType, targetIds: Array<ValueType>, relationName: string): Promise<SaveResult> {
this.ensureWritePathAllowed('SYNC')
return await this.withSessionStore(async (repo) => {
const result = await repo.relationManager.sync(sourceId, targetIds, relationName)
return repo.ensureSav... | https://github.com/offlinecat-dev/OCNetORM | 2a7a7f98a8dcc7619480f1fdd26777e25ac30cc8 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets | arkts | getFirstValue | Return the value of the first element in the TreeSet
@returns the value of the first element if exists | getFirstValue(): T {
return this.treeMap.getFirstKey();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFirstValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#state... | getFirstValue(): T {
return this.treeMap.getFirstKey();
} | https://gitcode.com/iop123123/arkts-static-skills | a6b854dd2ee4e394a36f061e72f2346f7c8bde2f | gitcode |
CsCesium/KantaiHomo | entry/src/main/ets/app/pages/components/info/ShipInfoPage.ets | arkts | typeLabel | ==================== Pure helpers ==================== | function typeLabel(stype: number): string {
return STYPE_LABELS.get(stype) ?? `舰种${stype}`;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left typeLabel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stype AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function typeLabel(stype: number): string {
return STYPE_LABELS.get(stype) ?? `舰种${stype}`;
} | https://github.com/CsCesium/KantaiHomo | 526d3346a26f9677917297e149f8c190e48b54a1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Authentication/LoginManager.ets | arkts | extractCookiesFromResponse | 从响应中提取Cookie | private extractCookiesFromResponse(response: http.HttpResponse): Record<string, string> {
const cookies: Record<string, string> = {};
try {
const headers = response.header as Record<string, Object>;
const setCookieHeader = headers['set-cookie'] || headers['Set-Cookie'];
if (!setC... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractCookiesFromResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | private extractCookiesFromResponse(response: http.HttpResponse): Record<string, string> {
const cookies: Record<string, string> = {};
try {
const headers = response.header as Record<string, Object>;
const setCookieHeader = headers['set-cookie'] || headers['Set-Cookie'];
if (!setC... | https://github.com/DaLongZhuaZi/manxia | 5d00539d9b5dea1fbfbb658f08ec74465f7667a8 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/IndexManager.ets | arkts | createOCRRecognitionIndexes | 创建OCR识别表的索引 | private static async createOCRRecognitionIndexes(): Promise<void> {
const store = DatabaseManager.getDatabase();
try {
// OCR识别记录表 - 用户识别记录索引
await store.executeSql(`
CREATE INDEX IF NOT EXISTS idx_ocr_records_user
ON ocr_recognition_records(user_id, created_at DESC)
WHERE... | 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 createOCRRecognitionIndexes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Rig... | private static async createOCRRecognitionIndexes(): Promise<void> {
const store = DatabaseManager.getDatabase();
try {
// OCR识别记录表 - 用户识别记录索引
await store.executeSql(`
CREATE INDEX IF NOT EXISTS idx_ocr_records_user
ON ocr_recognition_records(user_id, created_at DESC)
WHERE... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | c9c2137a1f81326996d705db2eb58a0cb3c8c406 | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/popup/index.ets | arkts | getOffsetY | 垂直定位偏移量
@returns | getOffsetY() {
if (['top', 'left', 'right'].includes(this.placement)) {
return this.safeAreaInsetTop ? WuGlobalData.safeAreaInsetTop : 0
}
if (this.placement === 'bottom') {
return this.safeAreaInsetBottom ? -1 * WuGlobalData.safeAreaInsetBottom : 0
}
return 0
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getOffsetY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | getOffsetY() {
if (['top', 'left', 'right'].includes(this.placement)) {
return this.safeAreaInsetTop ? WuGlobalData.safeAreaInsetTop : 0
}
if (this.placement === 'bottom') {
return this.safeAreaInsetBottom ? -1 * WuGlobalData.safeAreaInsetBottom : 0
}
return 0
} | https://github.com/itrainhub/wu-ui | 076313f536cab252ad353438c7e1b52eda23b3d4 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/model/RemoteHost.ets | arkts | toJSON | 序列化为 JSON | toJSON(): RemoteHostJSON {
return {
id: this.id,
userId: this.userId,
label: this.label,
customHostname: this.customHostname,
protocol: this.protocol,
host: this.host,
port: this.port,
username: this.username,
password: this.password,
locked: this.locked... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toJSON 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 RemoteHostJSON AST#identifier#Right AST#ERROR#Right AST... | toJSON(): RemoteHostJSON {
return {
id: this.id,
userId: this.userId,
label: this.label,
customHostname: this.customHostname,
protocol: this.protocol,
host: this.host,
port: this.port,
username: this.username,
password: this.password,
locked: this.locked... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 61899bcbbbda96a6c5e54ed628db7272202a11e7 | github |
erosTeam/NextE | shared/src/main/ets/utils/RootRefreshRegistry.ets | arkts | trigger | Fire the registered refresh for this Scroller's list, if any (no-op for tabs without a pull-refresh
list, e.g. downloads/settings). | static trigger(scroller: Scroller): void {
const action: (() => void) | undefined = RootRefreshRegistry.actions.get(scroller)
if (action !== undefined) {
action()
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left trigger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scroller AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Scro... | static trigger(scroller: Scroller): void {
const action: (() => void) | undefined = RootRefreshRegistry.actions.get(scroller)
if (action !== undefined) {
action()
}
} | https://github.com/erosTeam/NextE | bef2a2f2d3958dbd2fe474f341724e5d70e0f72c | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/ReplaceNestedReusableComponentByBuilder/ets/ReplaceNestedReusableComponentByBuilderReport.ets | arkts | build | 无需对@Prop修饰的变量进行aboutToReuse赋值,因为这些变量是由父组件传递给子组件的。如果在子组件中重新赋值这些变量,会导致重用的组件的内容重新触发状态刷新,从而降低组件的复用性能。 | build() {
// 在复用组件中嵌套使用自定义组件
Row() {
InteractiveButton({
imageStr: $r('app.media.ic_share'),
text: $r('app.string.friendMomentsPage_share')
})
Blank()
InteractiveButton({
imageStr: $r('app.media.ic_thumbsup'),
text: $r('app.string.friendMomentsPage_thumb... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#comment#Le... | build() {
// 在复用组件中嵌套使用自定义组件
Row() {
InteractiveButton({
imageStr: $r('app.media.ic_share'),
text: $r('app.string.friendMomentsPage_share')
})
Blank()
InteractiveButton({
imageStr: $r('app.media.ic_thumbsup'),
text: $r('app.string.friendMomentsPage_thumb... | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 77497599d278304504730fa81862024fac676605 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | shouldPrefetchPages | 判断是否应该预取页面
某些图源可能不支持或不需要预取 | private shouldPrefetchPages(): boolean {
// 默认启用页面预取
// 可以根据图源ID或其他条件决定是否预取
return true;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldPrefetchPages 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 bo... | private shouldPrefetchPages(): boolean {
// 默认启用页面预取
// 可以根据图源ID或其他条件决定是否预取
return true;
} | https://github.com/DaLongZhuaZi/manxia | 4b72fe2f0df1babce03b1f320d7d7d6027932f50 | github |
trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS | sensitiveinput/src/main/ets/module/SensitiveWordChecker.ets | arkts | replaceSensitiveWords | 替换文本中的敏感词
@param text 待处理的文本
@param replacement 替换字符,默认为'*'
@returns 处理后的文本 | public replaceSensitiveWords(text: string, replacement: string = '*',replaceMode:ReplaceMode): ReplaceResult {
let result = text;
let offset = 0;
let words : Set<string> = new Set();
// 从文本的每个位置开始查找
for (let i = 0; i < result.length; i++) {
const resultWord = this.extractFromPosition(result... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceSensitiveWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public replaceSensitiveWords(text: string, replacement: string = '*',replaceMode:ReplaceMode): ReplaceResult {
let result = text;
let offset = 0;
let words : Set<string> = new Set();
// 从文本的每个位置开始查找
for (let i = 0; i < result.length; i++) {
const resultWord = this.extractFromPosition(result... | https://github.com/trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS | 7860d7ae147be63faaf08403569bc1217643c8da | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | write | Writes a string to the buffer at the specified offset
@param {string} str - String to write
@param {int} [offset=0] - Number of bytes to skip before writing
@param {int} [length] - Maximum number of bytes to write
@param {string} [encoding='utf8'] - Character encoding of the string
@returns {int} Number of bytes writte... | public write(str: string, offset: int = 0, length?: int, encoding: string = 'utf8'): int {
if (this.length === 0 ) {
throw createBusinessError(OutOfBoundsErrorCodeId, 'The buffer length is 0, and writing data is not allowed');
}
if (offset != 0) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left write AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public write(str: string, offset: int = 0, length?: int, encoding: string = 'utf8'): int {
if (this.length === 0 ) {
throw createBusinessError(OutOfBoundsErrorCodeId, 'The buffer length is 0, and writing data is not allowed');
}
if (offset != 0) {
... | https://gitcode.com/iop123123/arkts-static-skills | 150ee32036c0c8abe96d6e563d841a5cc8d7ecf1 | gitcode |
AuspiciousSign/HarmonyOS | entry/src/main/ets/database/Rdb.ets | arkts | updateData | 更新数据的方法,接收三个参数:谓词、存储键值对、回调函数 | updateData(predicates: relationalStore.RdbPredicates, data: relationalStore.ValuesBucket, callback: Function = () => {
}) {
// 如果回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'updateDate() has no callbac... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Le... | updateData(predicates: relationalStore.RdbPredicates, data: relationalStore.ValuesBucket, callback: Function = () => {
}) {
// 如果回调函数为空、或undefined 打印错误日志,退出方法
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'updateDate() has no callbac... | https://github.com/AuspiciousSign/HarmonyOS | 313e066f3fec96703ef7bb45e017a023654473bb | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | constructor | ========== 单例模式 ========== | private constructor() {
// 私有构造函数,防止直接实例化
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right 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#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
// 私有构造函数,防止直接实例化
} | https://github.com/the-wwyang/kids-learning-app | 0b261fc79252f91c70870e872b469031e8c7816d | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | isInteger | Return true if the value of this Decimal is an integer, otherwise return false.
@returns { boolean } the boolean type | public isInteger(): boolean {
return !!this.digits && Math.floor(this.exponent / LOG_BASE) > this.digits!.length - 2;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boo... | public isInteger(): boolean {
return !!this.digits && Math.floor(this.exponent / LOG_BASE) > this.digits!.length - 2;
} | https://gitcode.com/iop123123/arkts-static-skills | fd9cd74511c27a2df3d9594720aa75cd353f0d96 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/utils/ClipboardManager.ets | arkts | onRemoteClipboardReceived | Handle remote clipboard change (called from native callback) | onRemoteClipboardReceived(data: string): void {
if (!this.isEnabled || !data) return;
// Avoid echo
if (data === this.lastRemoteData || data === this.lastLocalData) return;
this.lastRemoteData = data;
// Update local clipboard
this.setLocalClipboard(data);
console.info(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRemoteClipboardReceived AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS... | onRemoteClipboardReceived(data: string): void {
if (!this.isEnabled || !data) return;
// Avoid echo
if (data === this.lastRemoteData || data === this.lastLocalData) return;
this.lastRemoteData = data;
// Update local clipboard
this.setLocalClipboard(data);
console.info(... | https://github.com/tangwengang-del/freerdp-harmonyos | 0ac417e75f4d24908a7638777fd17da3f2110a5e | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setFBDanmakuVisibility | �����Ƿ���ʾ�ײ���Ļ
@param visible | public setFBDanmakuVisibility(visible: boolean): DanmakuContext {
this.setDanmakuVisible(visible, BaseDanmaku.TYPE_FIX_BOTTOM);
this.setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, this.mFilterTypes);
this.mGlobalFlagValues.updateFilterFlag();
if (this.FBDanmakuVisibility != visible) {
thi... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFBDanmakuVisibility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left visible AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public setFBDanmakuVisibility(visible: boolean): DanmakuContext {
this.setDanmakuVisible(visible, BaseDanmaku.TYPE_FIX_BOTTOM);
this.setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, this.mFilterTypes);
this.mGlobalFlagValues.updateFilterFlag();
if (this.FBDanmakuVisibility != visible) {
thi... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | c104450c8ee3e9ab4c85aecc66afa317479dd984 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets | arkts | setJsLib | 设置jsLib(书源的JS库) | setJsLib(jsLib: string): void {
if (this.legadoEngine) {
this.legadoEngine.setJsLib(jsLib);
}
// Rhino沙箱的jsLib会随执行上下文注入,这里只同步降级引擎的库内容。
logger.debug(TAG, `已设置jsLib (${jsLib.length}字符)`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setJsLib AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsLib AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | setJsLib(jsLib: string): void {
if (this.legadoEngine) {
this.legadoEngine.setJsLib(jsLib);
}
// Rhino沙箱的jsLib会随执行上下文注入,这里只同步降级引擎的库内容。
logger.debug(TAG, `已设置jsLib (${jsLib.length}字符)`);
} | https://github.com/DaLongZhuaZi/manxia | 8a1186830af4f17357631d1e0beb6d5d4d6bb368 | github |
midori52000/ArkPilot | Agent/entry/src/main/ets/skills/SkillsBackendService.ets | arkts | getInstalled | ================================================================
已安装 Skill 管理
================================================================ | async getInstalled(): Promise<InstalledSkill[]> {
const json = getSkillsRegistry(this.codexHome);
const parsed: SkillsRegistryJson = JSON.parse(json) as SkillsRegistryJson;
let skills: SkillEntryJson[] = parsed.skills ?? [];
// 兜底:注册表为空时,尝试 reconcile(扫描 SSOT 目录自动注册)
if (skills.length === 0) {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getInstalled AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async getInstalled(): Promise<InstalledSkill[]> {
const json = getSkillsRegistry(this.codexHome);
const parsed: SkillsRegistryJson = JSON.parse(json) as SkillsRegistryJson;
let skills: SkillEntryJson[] = parsed.skills ?? [];
// 兜底:注册表为空时,尝试 reconcile(扫描 SSOT 目录自动注册)
if (skills.length === 0) {
... | https://github.com/midori52000/ArkPilot | 1d3bcc1b21806758108483866353b0415fb8494b | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/CrashTracker.ets | arkts | markCleanExit | Mark clean exit | markCleanExit(): void {
// Remove crash state file to indicate no crash occurred
try {
fileIo.unlinkSync(this.statePath);
} catch (e) {
// ignore
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markCleanExit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | markCleanExit(): void {
// Remove crash state file to indicate no crash occurred
try {
fileIo.unlinkSync(this.statePath);
} catch (e) {
// ignore
}
} | https://github.com/AGenUI/AGenUI | 8528e2ca0b1a11c8a06c88408ff826fdf80c0a03 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/OneDriveManager.ets | arkts | exportToVMShared | 导出文件到 VM 的共享文件夹
然后用户可以在 VM 里把文件拖到 OneDrive | public async exportToVMShared(vmName: string, fileName: string): Promise<boolean> {
try {
console.info(`[OneDriveManager] Exporting ${fileName} to VM ${vmName}`);
const sourcePath = `${this.config.cachePath}/${fileName}`;
// 复制到 VM 共享目录
const success = await this.driveManager... | 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 exportToVMShared AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left ... | public async exportToVMShared(vmName: string, fileName: string): Promise<boolean> {
try {
console.info(`[OneDriveManager] Exporting ${fileName} to VM ${vmName}`);
const sourcePath = `${this.config.cachePath}/${fileName}`;
// 复制到 VM 共享目录
const success = await this.driveManager... | https://github.com/AetheriumSimulator/qemu-hmos | a22566ec70f0dd598e002f64fa50e61537575b0f | github |
StarHeartY/CalculatorX | entry/src/main/ets/utils/EngineService.ets | arkts | cleanRawLatex | 1. 还原最纯净的 LaTeX,执行多层防御性正则清洗 | public static cleanRawLatex(rawLatexResult: string): string {
// 1. 去除首尾引号并处理转义,还原最纯净的 LaTeX
let rawLatex = rawLatexResult.replace(/^"|"$/g, '').replace(/\\\\/g, '\\');
// 2.定义带类型的正则替换器
let repC = (m: string, n1: string | undefined, n2: string | undefined, r1: string | undefined, r2: string | undefin... | 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 cleanRawLatex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rawLatexResult AST#identifier#Right AST#ERROR#Left AST#:... | public static cleanRawLatex(rawLatexResult: string): string {
// 1. 去除首尾引号并处理转义,还原最纯净的 LaTeX
let rawLatex = rawLatexResult.replace(/^"|"$/g, '').replace(/\\\\/g, '\\');
// 2.定义带类型的正则替换器
let repC = (m: string, n1: string | undefined, n2: string | undefined, r1: string | undefined, r2: string | undefin... | https://github.com/StarHeartY/CalculatorX | cceda3ea57517d707867a2dd09180dbfd80b7614 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/equal/equal_char.ets | arkts | main | ---
desc: check equality of two chars
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a == b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a == b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 544e0848d58eaf66837bd37f3bc29f70e7610d80 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setShadowColor | 设置阴影颜色
@param shadowColor
@returns | setShadowColor(shadowColor: string): Builder {
this.popupConfig.shadowColor = shadowColor
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setShadowColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shadowColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | setShadowColor(shadowColor: string): Builder {
this.popupConfig.shadowColor = shadowColor
return this
} | https://github.com/wuba/omni-ui | 218ffb9f902cddc5fa4080071e4502a081e78526 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GameManager.ets | arkts | uint8ArrayToBase64 | Uint8Array 转 Base64
使用鸿蒙 util.Base64Helper | private uint8ArrayToBase64(data: Uint8Array): string {
const base64Helper = new util.Base64Helper();
return base64Helper.encodeToStringSync(data);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left uint8ArrayToBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private uint8ArrayToBase64(data: Uint8Array): string {
const base64Helper = new util.Base64Helper();
return base64Helper.encodeToStringSync(data);
} | https://github.com/richshaw2015/nds | bd35f01b5a27de08a15eeda1e099d4a7d184ab0d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets | arkts | scheduleNextTurn | 安排下一次翻页 | private scheduleNextTurn(): void {
if (this.state !== AutoPageTurnState.RUNNING) {
return;
}
this.clearTimer();
const intervalMs = this.config.interval * 1000;
this.timer = setTimeout(() => {
void this.executeTurn();
}, intervalMs);
logger.debug(TAG, `下次翻页将在${this.config.int... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleNextTurn 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#ex... | private scheduleNextTurn(): void {
if (this.state !== AutoPageTurnState.RUNNING) {
return;
}
this.clearTimer();
const intervalMs = this.config.interval * 1000;
this.timer = setTimeout(() => {
void this.executeTurn();
}, intervalMs);
logger.debug(TAG, `下次翻页将在${this.config.int... | https://github.com/DaLongZhuaZi/manxia | 3b4260f062e4bf1a86481d311b8b8aed57666fba | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | constructor | Creates a new Blob object containing a concatenation of the given sources.
<ArrayBuffer>, <TypedArray>, <DataView>, and <Buffer> sources are copied into the 'Blob' and can therefore be safely modified after the 'Blob' is created.
String sources are encoded as UTF-8 byte sequences and copied into the Blob. Unmatched sur... | constructor(sources: FixedArrayUnionType, options?: BlobOptions) {
this.handleParameters(sources)
this.arrBuffer = this.flattenData(this.arr)
this.blobSize = this.arrBuffer.byteLength;
if (options != undefined) {
this.blobType = options!.type ? opt... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FixedArrayUnionType AST#id... | constructor(sources: FixedArrayUnionType, options?: BlobOptions) {
this.handleParameters(sources)
this.arrBuffer = this.flattenData(this.arr)
this.blobSize = this.arrBuffer.byteLength;
if (options != undefined) {
this.blobType = options!.type ? opt... | https://gitcode.com/iop123123/arkts-static-skills | 2687363fe5d8a7f97bbe267efee9e27de3ac8d80 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/view/PlaybackPage.ets | arkts | build | Root column with dismiss transform, pan-to-close, and lifecycle hooks. | build() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#42181f')
Column() {
Column() {
this.buildControlStack()
}
.height(this.dismissSheetHeightPercent(this.componentHeight))
.translate({ y: this.dismissSheetTra... | 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() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#42181f')
Column() {
Column() {
this.buildControlStack()
}
.height(this.dismissSheetHeightPercent(this.componentHeight))
.translate({ y: this.dismissSheetTra... | https://gitcode.com/HarmonyOS_Samples/MusicHome | f377097d8193ae7ed10e308e4e736b6af2530317 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets | arkts | constructor | 创建内存缓存管理
@param memoryCacheCapacity 内存缓存大小 | constructor(memoryCacheCapacity: number = 64) {
this.cache = new util.LRUCache(memoryCacheCapacity);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left memoryCacheCapacity AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST... | constructor(memoryCacheCapacity: number = 64) {
this.cache = new util.LRUCache(memoryCacheCapacity);
} | https://gitcode.com/arkui-x/samples | 63cee3a84f4252bbeccc5cbb8061633618e82345 | gitcode |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | dispose | Disconnect the session, stop all background threads, and free native resources. | dispose(): void {
if (this.handle) {
try {
ssh.disconnect(this.handle);
} catch (e) {
// Ignore disconnect errors
}
this.handle = null;
}
this.state = SshState.DISCONNECTED;
this.emit('close');
this.removeAllListeners();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dispose 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 AS... | dispose(): void {
if (this.handle) {
try {
ssh.disconnect(this.handle);
} catch (e) {
// Ignore disconnect errors
}
this.handle = null;
}
this.state = SshState.DISCONNECTED;
this.emit('close');
this.removeAllListeners();
} | https://github.com/UnbalancedCat/ohos-ssh-core | 66f2d6cc7e75b05f74d16158680c069c2190b2ea | github |
openharmony-sig/knowledge_demo_travel | FA/WiFiScanner/entry/src/main/ets/MainAbility/model/WifiModel.ets | arkts | disconnectWiFi | Disconnect wifi | disconnectWiFi() {
this.setUserSelectedAp(null);
let ret = wifi.disconnect();
console.log('disconnect WiFi result is : ' + ret);
return ret;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left disconnectWiFi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | disconnectWiFi() {
this.setUserSelectedAp(null);
let ret = wifi.disconnect();
console.log('disconnect WiFi result is : ' + ret);
return ret;
} | https://gitee.com/openharmony-sig/knowledge_demo_travel.git | 685f7c1faf7e4445214c5106b62d04248471b676 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int16Array with respect to data accessed via Iterable<Number> interface
@param { Iterable<Number> } elements - an iterable object
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(elements: Iterable<Number>) {
const items: Object = elements as Object
if (items instanceof ArrayLike) {
const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>)
this.byteLength = arr.length * Int16Array.BYTES_PER_ELEMENT
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex... | public constructor(elements: Iterable<Number>) {
const items: Object = elements as Object
if (items instanceof ArrayLike) {
const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>)
this.byteLength = arr.length * Int16Array.BYTES_PER_ELEMENT
... | https://gitcode.com/iop123123/arkts-static-skills | edc27f59ea5be8ed21fe69812c4408f6f0ee0af8 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/BookTransitionOverlay.ets | arkts | prepareCloseTransition | 准备关闭过渡(显示全屏遮罩层,用于截图前冻结画面)
@param coverPosition 封面目标位置 | public prepareCloseTransition(coverPosition: CoverPosition): void {
logger.info(TAG, '准备关闭过渡(显示遮罩层)');
// 计算最终封面位置
let finalCoverPosition: CoverPosition;
if (this.isValidCoverPosition(coverPosition) && !this.isDefaultCoverPosition(coverPosition)) {
finalCoverPosition = coverPosition;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left prepareCloseTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left coverPosition AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | public prepareCloseTransition(coverPosition: CoverPosition): void {
logger.info(TAG, '准备关闭过渡(显示遮罩层)');
// 计算最终封面位置
let finalCoverPosition: CoverPosition;
if (this.isValidCoverPosition(coverPosition) && !this.isDefaultCoverPosition(coverPosition)) {
finalCoverPosition = coverPosition;
... | https://github.com/DaLongZhuaZi/manxia | 1c7c574ad42f5a208f2a895b1e280f89e86b89cf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/DownloadDirManager.ets | arkts | doRequestAccess | 执行实际的授权请求 | private async doRequestAccess(): Promise<boolean> {
try {
if (!this.context) {
logger.error(TAG, '应用上下文未设置');
return false;
}
if (this.restorePersistedDirInfo()) {
return true;
}
const documentViewPicker = new picker.DocumentViewPicker(this.context);
c... | 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 doRequestAccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async doRequestAccess(): Promise<boolean> {
try {
if (!this.context) {
logger.error(TAG, '应用上下文未设置');
return false;
}
if (this.restorePersistedDirInfo()) {
return true;
}
const documentViewPicker = new picker.DocumentViewPicker(this.context);
c... | https://github.com/DaLongZhuaZi/manxia | 38a31f13513b2ed4a4aaa1e5528d37a81be58339 | github |
PollenWang6/HiXD | entry/src/main/ets/services/SchoolnetService.ets | arkts | validateZfwUser | 验证用户(pre-login)
对齐 Flutter: POST /site/validate-user | async validateZfwUser(
username: string,
encryptedPwd: string,
verifyCode: string,
csrf: string
): Promise<ZfwValidateResult> {
const data: Record<string, string> = {};
data['LoginForm[username]'] = username;
data['LoginForm[password]'] = encryptedPwd;
data['LoginForm[verifyCode]'] =... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left validateZfwUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async validateZfwUser(
username: string,
encryptedPwd: string,
verifyCode: string,
csrf: string
): Promise<ZfwValidateResult> {
const data: Record<string, string> = {};
data['LoginForm[username]'] = username;
data['LoginForm[password]'] = encryptedPwd;
data['LoginForm[verifyCode]'] =... | https://github.com/PollenWang6/HiXD | 261f0396a7c838db608c8f8e31b8c1aa280ac63c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | onConfigChange | 注册配置变化监听器 | public onConfigChange(callback: (profile: UserThemeProfile) => void): void {
this.changeCallbacks.add(callback);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left onConfigChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#... | public onConfigChange(callback: (profile: UserThemeProfile) => void): void {
this.changeCallbacks.add(callback);
} | https://github.com/DaLongZhuaZi/manxia | 43e884613bb8af9341438ccf6bd92cba835ef72b | github |
azhu0001/localsend-harmony | entry/src/main/ets/transaction/LongTakeAnimationProperties.ets | arkts | setFinalStatus | When you do not go through the custom transition, you need to set the state to the normal final state. | public setFinalStatus(): void {
this.navDestinationBgColor = $r('app.color.background');
this.clipWidth = '100%';
this.clipHeight = '100%';
this.snapShotOpacity = 0;
this.postPageOpacity = 1;
this.radius = 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFinalStatus 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#express... | public setFinalStatus(): void {
this.navDestinationBgColor = $r('app.color.background');
this.clipWidth = '100%';
this.clipHeight = '100%';
this.snapShotOpacity = 0;
this.postPageOpacity = 1;
this.radius = 0;
} | https://gitcode.com/azhu0001/localsend-harmony | c8aeba3aca0be3f7bf238c8213e5e79fc53e6605 | gitcode |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets | arkts | peekNextSetIndices | 水平滑动预览:下一页(跨页)索引;若无下一套则返回空数组 | peekNextSetIndices(): number[] {
if (this.totalPageCount <= 0) {
return [];
}
const baseDisplayed: number[] = this.slideNavEffectiveStartIndex !== undefined
? this.calculateDisplayIndices(this.slideNavEffectiveStartIndex)
: this.displayedPageIndices;
const raw = this.navigateToNextPa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left peekNextSetIndices 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#number#Left number AST#number#Right AST#ERRO... | peekNextSetIndices(): number[] {
if (this.totalPageCount <= 0) {
return [];
}
const baseDisplayed: number[] = this.slideNavEffectiveStartIndex !== undefined
? this.calculateDisplayIndices(this.slideNavEffectiveStartIndex)
: this.displayedPageIndices;
const raw = this.navigateToNextPa... | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets#L563-L577 | 19f51738b5e07bbb35fad25658118b1e73b2f584 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.